private void DrawManageMenus() { bool hasMenuControllerSelected = _editorMenuCreatorSettings.MenuController; if (!hasMenuControllerSelected) { EditorGUILayout.HelpBox("Select a MenuController to change specific menus.", MessageType.Info); } if (hasMenuControllerSelected) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Specific menus", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); _editorMenuCreatorSettings.DetailView = EditorGUILayout.Toggle("Detailed", _editorMenuCreatorSettings.DetailView); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); _menuController.Update(); SerializedProperty arrayProperty = _menuController.FindProperty("_mcMenus"); for (int i = 0; i < arrayProperty.arraySize; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(arrayProperty.GetArrayElementAtIndex(i)); if (GUILayout.Button("Remove")) { RemoveMenuFromController(i); } EditorGUILayout.EndHorizontal(); // Show extra details, like the menuId. if (_editorMenuCreatorSettings.DetailView) { using (new EditorGUI.IndentLevelScope()) { SerializedObject serializedMenu = new SerializedObject(arrayProperty.GetArrayElementAtIndex(i).objectReferenceValue); SerializedProperty serializedMenuID = serializedMenu.FindProperty("_id"); if (serializedMenuID != null) { EditorGUILayout.PropertyField(serializedMenuID); } serializedMenu.ApplyModifiedProperties(); } } } EditorGUILayout.Space(); _menuController.ApplyModifiedProperties(); DragDrop.DrawDragDrop("Drag menus to add them", objects => { foreach (Object dropObject in objects) { GameObject gameObject = dropObject as GameObject; if (gameObject) { MCMenu mcMenu = gameObject.GetComponentInChildren <MCMenu>(); AddMenuToController(mcMenu); } } }, 40); EditorGUILayout.Space(); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); EditorGUILayout.Space(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Shared menus", EditorStyles.boldLabel); EditorGUILayout.Space(); if (GUILayout.Button("", GUI.skin.GetStyle("IN ObjectField"))) { EditorGUIUtility.PingObject(_menuControllerSharedProps); } EditorGUILayout.EndHorizontal(); EnsureSharedProps(); _menuControllerSharedPropsObject.Update(); SerializedProperty sharedMenusProperty = _menuControllerSharedPropsObject.FindProperty("_menus"); for (int i = 0; i < sharedMenusProperty.arraySize; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(sharedMenusProperty.GetArrayElementAtIndex(i)); if (GUILayout.Button("Remove")) { RemoveSharedMenuFromController(i); } EditorGUILayout.EndHorizontal(); } _menuControllerSharedPropsObject.ApplyModifiedProperties(); EditorGUILayout.Space(); DragDrop.DrawDragDrop("Drag menus to add them", objects => { foreach (Object dropObject in objects) { GameObject gameObject = dropObject as GameObject; if (gameObject) { MCMenu mcMenu = gameObject.GetComponentInChildren <MCMenu>(); AddSharedMenuToController(mcMenu); } } }, 40); }