/// <summary> /// Needed so MainGUI doesnt go on top of MainMenu /// </summary> internal void ReLoadMainMenuIfActive() { var forms = FindObjectsOfType <MyForm>(); for (int i = 0; i < forms.Length; i++) { if (forms[i] != null && forms[i].MyId.Contains("MainMenu")) { RedifineWindows(); _mainMenuWindow.Destroy(); _mainMenuWindow = null; _newGameWindow.Destroy(); _newGameWindow = null; SaveLoadGameWindow.Destroy(); SaveLoadGameWindow = null; _optionsWindow.Destroy(); _optionsWindow = null; if (_achieveWindow) { _achieveWindow.Destroy(); _achieveWindow = null; } DestroyCurrentMenu(); LoadMainMenu(); Debug.Log("Reload Main Menu ReLoadMainMenuIfActive"); RedifineWindows(); } } }
private void RedifineWindows() { if (_mainMenuWindow == null) { _mainMenuWindow = FindObjectOfType <MainMenuWindow>(); } if (_newGameWindow == null) { _newGameWindow = FindObjectOfType <NewGameWindow>(); } if (SaveLoadGameWindow == null) { SaveLoadGameWindow = FindObjectOfType <SaveLoadGameWindow>(); } if (_optionsWindow == null) { _optionsWindow = FindObjectOfType <OptionsWindow>(); } if (_achieveWindow == null) { _achieveWindow = FindObjectOfType <AchieveWindow>(); } }