diff --git a/Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs b/Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs index 3e00bea6..d445eb59 100644 --- a/Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs +++ b/Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs @@ -114,39 +114,14 @@ namespace Fungus.Script GUILayout.Box("New Command", GUILayout.ExpandWidth(true)); - List categories = new List(); - - // Build list of categories - List subTypes = EditorExtensions.FindDerivedTypes(typeof(FungusCommand)).ToList(); - foreach(System.Type type in subTypes) - { - object[] attributes = type.GetCustomAttributes(false); - foreach (object obj in attributes) - { - CommandCategoryAttribute categoryAttr = obj as CommandCategoryAttribute; - if (categoryAttr != null) - { - if (!categories.Contains(categoryAttr.Category)) - { - categories.Add(categoryAttr.Category); - } - } - } - } - - categories.Sort(); - EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); - int selectedCategoryIndex = EditorGUILayout.Popup(fungusScript.selectedCategoryIndex, categories.ToArray()); - List commandNames = new List(); - List commandTypes = new List(); - - string categoryName = categories[selectedCategoryIndex]; - foreach (System.Type type in subTypes) + List commandTypes = EditorExtensions.FindDerivedTypes(typeof(FungusCommand)).ToList(); + + foreach (System.Type type in commandTypes) { object[] attributes = type.GetCustomAttributes(false); foreach (object obj in attributes) @@ -154,27 +129,18 @@ namespace Fungus.Script CommandCategoryAttribute categoryAttr = obj as CommandCategoryAttribute; if (categoryAttr != null) { - if (categoryAttr.Category == categoryName) - { - commandNames.Add(GetCommandName(type)); - commandTypes.Add(type); - } + string commandItem = categoryAttr.Category + " / " + GetCommandName(type); + commandNames.Add(commandItem); + break; } } } int selectedCommandIndex = EditorGUILayout.Popup(fungusScript.selectedCommandIndex, commandNames.ToArray()); - if (selectedCategoryIndex != fungusScript.selectedCategoryIndex) - { - // Default to first item in list if category has changed - selectedCommandIndex = 0; - } - if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(fungusScript, "Select Command"); - fungusScript.selectedCategoryIndex = selectedCategoryIndex; fungusScript.selectedCommandIndex = selectedCommandIndex; } diff --git a/Assets/Fungus/FungusScript/Scripts/FungusScript.cs b/Assets/Fungus/FungusScript/Scripts/FungusScript.cs index 5e4addcc..e8e1dd1c 100644 --- a/Assets/Fungus/FungusScript/Scripts/FungusScript.cs +++ b/Assets/Fungus/FungusScript/Scripts/FungusScript.cs @@ -15,9 +15,6 @@ namespace Fungus.Script [System.NonSerialized] public FungusCommand copyCommand; - [HideInInspector] - public int selectedCategoryIndex; - [HideInInspector] public int selectedCommandIndex; diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index d149ef20..4aa2de9c 100644 Binary files a/Assets/Shuttle/ShuttleGame.unity and b/Assets/Shuttle/ShuttleGame.unity differ