private static void DrawOrientationBlock(Menu menu, ERealOrientation orientation) { EditorGUILayout.BeginHorizontal(); GameObject panel = orientation == ERealOrientation.Horizontal ? menu.HorizontalPanel : menu.VerticalPanel; MenuView view = orientation == ERealOrientation.Horizontal ? menu.HorizontalView : menu.VerticalView; if (panel == null) { panel = AGameObjectTool.CreateGameObject(orientation == ERealOrientation.Horizontal ? "Horizontal Panel" : "Vertical Panel", menu.gameObject); } EditorGUILayout.LabelField(orientation == ERealOrientation.Horizontal ? "Horizontal:" : "Vertical:", GUILayout.Width(SMALL_WIDTH)); if (view == null) { view = panel.GetComponent <MenuView>(); } if (view == null) { panel = (GameObject)EditorGUILayout.ObjectField(panel, typeof(GameObject), true); } else { view = (MenuView)EditorGUILayout.ObjectField(view, typeof(MenuView), true); } if (orientation == ERealOrientation.Horizontal) { menu.HorizontalPanel = panel; menu.HorizontalView = view; } else { menu.VerticalPanel = panel; menu.VerticalView = view; } if (menu.OrientationStyle != EMenuOrientationStyle.Both) { GameObject unusedPanel = orientation == ERealOrientation.Horizontal ? menu.VerticalPanel : menu.HorizontalPanel; if (unusedPanel != null) { DestroyImmediate(unusedPanel); } } EditorGUILayout.EndHorizontal(); }
public static void CreateMenuManager() { if (GameObject.FindObjectOfType <MenuManager>() != null) { Debug.Log("Menu Manager already exists in this scene!"); return; } GameObject manager = AGameObjectTool.CreateGameObject("Menu Manager"); manager.AddComponent <AEngine.Menu.MenuManager>(); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); }