public void Back() { if (menuPath.Count <= 1) { return; } MenuInfo last = menuPath[menuPath.Count - 1]; MenuInfo secondToLast = menuPath[menuPath.Count - 2]; last.Exit(); secondToLast.Enter(); menuPath.RemoveAt(menuPath.Count - 1); activeMenu = secondToLast; //clear the selected object EventSystem.current.SetSelectedGameObject(null); //set the selected menu button EventSystem.current.SetSelectedGameObject(mainFirstButton); }
public void RequestMenu(string menuName) { if (activeMenu != null) { if (menuName == activeMenu.name) { return; } else { activeMenu.Exit(); } } for (int i = 0; i < menues.Length; i++) { if (menues[i].name == menuName) { StartCoroutine(MenuDelay(1f)); activeMenu = menues[i]; activeMenu.Enter(); menuPath.Add(activeMenu); } } }