diff --git a/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs b/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs index 98127903..580a77c0 100755 --- a/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs @@ -10,7 +10,9 @@ namespace Fungus.Script public class FungusEditorWindow : EditorWindow { private List windowSequenceMap = new List(); - + + static public FungusScript activeFungusScript; + [MenuItem("Window/Fungus Editor")] static void Init() { @@ -24,31 +26,17 @@ namespace Fungus.Script static public FungusScript GetFungusScript() { - GameObject activeObject = Selection.activeGameObject; - - while (activeObject != null) + if (Selection.activeGameObject != null) { - FungusScript fungusScript = activeObject.GetComponent(); - Sequence sequence = activeObject.GetComponent(); + FungusScript fungusScript = Selection.activeGameObject.GetComponent(); if (fungusScript != null) { - // Found sequence controller - return fungusScript; - } - else if (sequence != null && - sequence.transform.parent != null) - { - // Check parent for sequence controller - activeObject = sequence.transform.parent.gameObject; - } - else - { - activeObject = null; + activeFungusScript = fungusScript; } } - return null; + return activeFungusScript; } void OnGUI() @@ -167,6 +155,8 @@ namespace Fungus.Script { FungusScript fungusScript = s.GetFungusScript(); fungusScript.selectedSequence = s; + + Selection.activeGameObject = fungusScript.gameObject; } } } diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index 5265796f..61e173f1 100644 Binary files a/Assets/Shuttle/ShuttleGame.unity and b/Assets/Shuttle/ShuttleGame.unity differ