From a806880acca10896f3bb1c3fd9a0ae441d9b10ec Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 7 Jul 2016 16:46:34 +0100 Subject: [PATCH] Fixed private Flowchart variables not substituting correctly --- Assets/Fungus/Flowchart/Scripts/Flowchart.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs index 617cee5b..df78a9ae 100644 --- a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs @@ -1029,7 +1029,9 @@ namespace Fungus // Instantiate the regular expression object. Regex r = new Regex("{\\$.*?}"); - + + bool changed = false; + // Match the regular expression pattern against a text string. var results = r.Matches(input); foreach (Match match in results) @@ -1047,13 +1049,16 @@ namespace Fungus { string value = variable.ToString(); sb.Replace(match.Value, value); + changed = true; } } } // Now do all other substitutions in the scene - if (stringSubstituer.SubstituteStrings(sb)) - { + changed |= stringSubstituer.SubstituteStrings(sb); + + if (changed) + { return sb.ToString(); } else