From 5587311a2db48d263306294edfca0973de55fa5d Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 23 Mar 2016 12:08:16 +0000 Subject: [PATCH] Fixed private variable values being reset with multiple flowcharts #389 --- Assets/Fungus/Flowchart/Editor/VariableEditor.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Assets/Fungus/Flowchart/Editor/VariableEditor.cs b/Assets/Fungus/Flowchart/Editor/VariableEditor.cs index 3daea4ed..bd3b1c57 100644 --- a/Assets/Fungus/Flowchart/Editor/VariableEditor.cs +++ b/Assets/Fungus/Flowchart/Editor/VariableEditor.cs @@ -51,6 +51,17 @@ namespace Fungus Variable selectedVariable = property.objectReferenceValue as Variable; + // When there are multiple Flowcharts in a scene with variables, switching + // between the Flowcharts can cause the wrong variable property + // to be inspected for a single frame. This has the effect of causing private + // variable references to be set to null when inspected. When this condition + // occurs we just skip displaying the property for this frame. + if (selectedVariable != null && + selectedVariable.gameObject != flowchart.gameObject) + { + return; + } + foreach (Variable v in variables) { if (filter != null)