void SwapTo(Windows state) { canvas_menu.SetActive(false); canvas_rules.SetActive(false); canvas_lobby.SetActive(false); canvas_credits.SetActive(false); canvas_settings.SetActive(false); switch (state) { case Windows.Menu: canvas_menu.SetActive(true); break; case Windows.Credits: canvas_credits.SetActive(true); break; case Windows.Rules: canvas_rules.SetActive(true); break; case Windows.Lobby: canvas_lobby.SetActive(true); break; case Windows.Settings: settings.refresh(); canvas_settings.SetActive(true); break; default: Debug.LogError("Trying to set invalid state"); break; } }