/// <summary> /// Open side menu by reference, and close the current active one. /// </summary> /// <param name="sideMenuName"></param> public void OpenSideMenu(SideMenu sideMenu) { SideMenu lastSM = CurActiveSideMenu; bool foundIt = false; foreach (SideMenu sM in AllSideMenus) { if (sM == sideMenu) { sM.ChangeVisibility(true); CurActiveSideMenu = sM; foundIt = true; } } if (lastSM && lastSM != CurActiveSideMenu) { lastSM.ChangeVisibility(false); } if (!foundIt) { Debug.LogError("There's no side menu named \"" + sideMenu.name + "\" inside Menu Manager's \"All Side Menus\" list.", gameObject); } }
/// <summary> /// Close the current active side menu if found. /// </summary> public void CloseSideMenu() { if (CurActiveSideMenu) { CurActiveSideMenu.ChangeVisibility(false); CurActiveSideMenu = null; } }