From 74bb0a384746507e6d93ab9b2379c19d673f741d Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Mon, 18 Aug 2014 16:07:04 +0100 Subject: [PATCH] Fungus Editor window remembers most recent selection --- .../Editor/FungusScript/FungusEditorWindow.cs | 28 ++++++------------ Assets/Shuttle/ShuttleGame.unity | Bin 83444 -> 83444 bytes 2 files changed, 9 insertions(+), 19 deletions(-) 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 5265796f71b5a32e3ed94a255d39db1b17028a87..61e173f133dfe7eb18c3d6bb24b990b468ac086b 100644 GIT binary patch delta 82 zcmey;&HAOAwP6e6J1)i*)8BJ3W=_Ar!pJdwfgYm;h{dvf4mYEkIHTA0!%B>2*<|#R d+nsjQ@i{XvFxUez!(+wgQ80S@8cjwI833$<8fgFk delta 72 zcmey;&HAOAwP6e6J1)iz)8BJ3W=?mIWaQYMz|EK>&gi}UuoB~0HW>yW5U5vi22%DQ T_G888Q6L%wwy)7-^pF7nJYN#I