public void CloseMenu(TutorialMenu menu) { if (menuStack.Count == 0) { Debug.LogErrorFormat(menu, "{0} cannot be closed because menu stack is empty", menu.GetType()); return; } if (menuStack.Peek() != menu) { Debug.LogErrorFormat(menu, "{0} cannot be closed because it is not on top of stack", menu.GetType()); return; } CloseTopMenu(); }