主要问题是,您将同一组传递到
ActivateTabs(group);
和
DeactivateTabs(group);
private void EfficientTabChange(CanvasGroup group)
{
CanvasGroup [] groups = new CanvasGroup[2] { hydrogenScreen, heliumScreen };
foreach (CanvasGroup g in groups)
{
if (g == group)
{
ActivateTabs(g);
}
else
{
DeactivateTabs(g);
}
}
}