From 4e1ee2e1230d9d9a617d6281fe040a18a31e52b2 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Mon, 13 Apr 2015 21:49:42 +0100 Subject: [PATCH] Blocks and 1st command select automatically when executed --- Assets/Fungus/Flowchart/Scripts/Block.cs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Assets/Fungus/Flowchart/Scripts/Block.cs b/Assets/Fungus/Flowchart/Scripts/Block.cs index f6b0243e..f89d2053 100644 --- a/Assets/Fungus/Flowchart/Scripts/Block.cs +++ b/Assets/Fungus/Flowchart/Scripts/Block.cs @@ -158,18 +158,12 @@ namespace Fungus executionState = ExecutionState.Executing; #if UNITY_EDITOR - // If no block is currently executing, then automatically select this block for display in the inspector. - bool found = false; - foreach (Block block in flowchart.GetComponentsInChildren()) + // Select the executing block & the first command + flowchart.selectedBlock = this; + if (commandList.Count > 0) { - if (block.executionState == ExecutionState.Executing) - { - found = true; - } - } - if (found) - { - flowchart.selectedBlock = this; + flowchart.ClearSelectedCommands(); + flowchart.AddSelectedCommand(commandList[0]); } #endif @@ -245,7 +239,6 @@ namespace Fungus executionState = ExecutionState.Idle; activeCommand = null; - flowchart.ClearSelectedCommands(); } public virtual void Stop()