public void SwitchPanel(LobbyMenuPanel newPanel) { if (currentPanel != null) { currentPanel.gameObject.SetActive(false); if (newPanel != topMenuPanel) { topMenuPanel.previousPanel = currentPanel; } else { topMenuPanel.previousPanel = null; } } if (newPanel != null) { newPanel.gameObject.SetActive(true); } else { currentPanel.gameObject.SetActive(false); } currentPanel = newPanel; if (currentPanel != mainMenuPanel && isInGame == false) { topMenuPanel.gameObject.SetActive(true); } else { topMenuPanel.gameObject.SetActive(false); } }
void Start() { _lobbyHooks = GetComponent <LobbyHook>(); // Disable all panels settingsPanel.gameObject.SetActive(false); setupPanel.gameObject.SetActive(false); characterSelectionPanel.gameObject.SetActive(false); topMenuPanel.gameObject.SetActive(false); lobbyInfoPanel.gameObject.SetActive(false); // Set default panel currentPanel = mainMenuPanel; SwitchPanel(mainMenuPanel); DontDestroyOnLoad(gameObject); }