public void SetActiveMenuScreen(AMenuScreen menuScreen) { AMenuScreen previousScreen = currentActiveMenuScreen; if (previousScreen) { previousScreen.Close(menuScreen.GetType()); } currentActiveMenuScreen = menuScreen; menuScreen.Open(previousScreen?.GetType()); }
/// <summary> /// Goes back from the current MenuScreen. /// </summary> public void GoBack() { AMenuScreen menuScreen = GetComponentInParent <AMenuScreen>(); if (menuScreen) { menuScreen.GoBack(); } else { Debug.LogError("BackButton isn't a child of any AMenuScreen.", this); } }