From d2acf9772f20105eb11cba5ddba0d25c8fa2236e Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 15 Apr 2015 13:33:56 +0100 Subject: [PATCH] Handle special case of block calling itself --- Assets/Fungus/Flowchart/Scripts/Commands/Call.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Call.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Call.cs index 6075ffb3..392cc6e1 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Call.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Call.cs @@ -36,6 +36,14 @@ namespace Fungus if (targetBlock != null) { + // Check if calling your own parent block + if (targetBlock == parentBlock) + { + // Just ignore the callmode in this case, and jump to first command in list + Continue(0); + return; + } + // Callback action for Wait Until Finished mode Action onComplete = null; if (callMode == CallMode.WaitUntilFinished)