Browse Source

Fix bug found by @FatPuzo by force returning local value on global variables when their value is requested outside of play mode

master
desktop-maesty/steve 7 years ago
parent
commit
b61a918075
  1. 10
      Assets/Fungus/Scripts/Components/Variable.cs

10
Assets/Fungus/Scripts/Components/Variable.cs

@ -121,10 +121,14 @@ namespace Fungus
{ {
return _globalStaicRef; return _globalStaicRef;
} }
else else if(Application.isPlaying)
{ {
return _globalStaicRef = FungusManager.Instance.GlobalVariables.GetOrAddVariable(Key, value, this.GetType()); return _globalStaicRef = FungusManager.Instance.GlobalVariables.GetOrAddVariable(Key, value, this.GetType());
} }
else
{
return null;
}
} }
} }
@ -133,7 +137,7 @@ namespace Fungus
{ {
get get
{ {
if (scope != VariableScope.Global) if (scope != VariableScope.Global || !Application.isPlaying)
{ {
return this.value; return this.value;
} }
@ -144,7 +148,7 @@ namespace Fungus
} }
set set
{ {
if (scope != VariableScope.Global) if (scope != VariableScope.Global || !Application.isPlaying)
{ {
this.value = value; this.value = value;
} }

Loading…
Cancel
Save