Browse Source

Merge pull request #364 from FungusGames/set-execution-info

Fixed ensure parentBlock is set when block executes #320
master
Chris Gregan 9 years ago
parent
commit
63c7413244
  1. 14
      Assets/Fungus/Flowchart/Scripts/Block.cs

14
Assets/Fungus/Flowchart/Scripts/Block.cs

@ -64,7 +64,14 @@ namespace Fungus
[NonSerialized]
public int jumpToCommandIndex = -1;
protected bool executionInfoSet = false;
protected virtual void Awake()
{
SetExecutionInfo();
}
protected virtual void SetExecutionInfo()
{
// Give each child command a reference back to its parent block
// and tell each command its index in the list.
@ -79,6 +86,8 @@ namespace Fungus
command.parentBlock = this;
command.commandIndex = index++;
}
executionInfoSet = true;
}
#if UNITY_EDITOR
@ -135,6 +144,11 @@ namespace Fungus
return false;
}
if (!executionInfoSet)
{
SetExecutionInfo();
}
executionCount++;
StartCoroutine(ExecuteBlock(onComplete));

Loading…
Cancel
Save