From cd8bf177750af114b8ba5eb164813e440a367f4e Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Tue, 19 Aug 2014 16:28:58 +0100 Subject: [PATCH] Fixed conditional hiding of transform component --- .../Editor/FungusScript/FungusScriptEditor.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs index 6003b81c..4df393c5 100644 --- a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs @@ -22,9 +22,25 @@ namespace Fungus.Script if (t != null) { - // Hide the transform component if FungusScript is the only component on the game object + // Hide the transform component if FungusScript & Variables are the only components on the game object + // Gives a bit more room in inspector for editing commands. The transform will become visible if any non-Fungus + // components are attached to the game object. Component[] components = t.GetComponents(typeof(Component)); - t.transform.hideFlags = (components.Length == 2) ? HideFlags.HideInInspector : HideFlags.None; + int count = 0; + foreach (Component component in components) + { + System.Type type = component.GetType(); + if (type == typeof(Transform) || + type == typeof(FungusScript) || + type == typeof(BooleanVariable) || + type == typeof(IntegerVariable) || + type == typeof(FloatVariable) || + type == typeof(StringVariable)) + { + count++; + } + } + t.transform.hideFlags = (count == components.Length) ? HideFlags.HideInInspector : HideFlags.None; } EditorGUI.BeginChangeCheck();