Browse Source

Hide transform if FungusScript is only component

master
chrisgregan 11 years ago
parent
commit
740ad69dd9
  1. 16
      Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs

16
Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs

@ -19,16 +19,13 @@ namespace Fungus.Script
{
variablesProperty = serializedObject.FindProperty("variables");
}
FungusScript t = target as FungusScript;
if (t != null)
{
t.transform.hideFlags = HideFlags.HideInInspector;
}
}
public void OnInspectorUpdate()
{
FungusScript t = target as FungusScript;
Repaint();
}
@ -38,6 +35,13 @@ namespace Fungus.Script
FungusScript t = target as FungusScript;
if (t != null)
{
// Hide the transform component if FungusScript is the only component on the game object
Component[] components = t.GetComponents(typeof(Component));
t.transform.hideFlags = (components.Length == 2) ? HideFlags.HideInInspector : HideFlags.None;
}
float stepTime = EditorGUILayout.FloatField(new GUIContent("Step Time", "Minimum time to execute each step"), t.stepTime);
EditorGUI.BeginChangeCheck();

Loading…
Cancel
Save