diff --git a/Assets/Example/Scenes/Example.unity b/Assets/Example/Scenes/Example.unity index 0093cd73..caf5b82c 100644 Binary files a/Assets/Example/Scenes/Example.unity and b/Assets/Example/Scenes/Example.unity differ diff --git a/Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs b/Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs index ea71ff8e..aefe5caa 100644 --- a/Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs +++ b/Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs @@ -127,7 +127,7 @@ namespace Fungus } Undo.RecordObject(fungusScript, "Add Variable"); - T newVariable = ScriptableObject.CreateInstance(); + T newVariable = fungusScript.gameObject.AddComponent(); newVariable.key = fungusScript.GetUniqueVariableKey(""); fungusScript.variables.Add(newVariable); } diff --git a/Assets/Fungus/FungusScript/Editor/IfEditor.cs b/Assets/Fungus/FungusScript/Editor/IfEditor.cs index aa560dc0..6dd6c829 100644 --- a/Assets/Fungus/FungusScript/Editor/IfEditor.cs +++ b/Assets/Fungus/FungusScript/Editor/IfEditor.cs @@ -50,7 +50,7 @@ namespace Fungus return; } - Variable selectedVariable = (Variable)variableProp.objectReferenceValue; + Variable selectedVariable = variableProp.objectReferenceValue as Variable; System.Type variableType = selectedVariable.GetType(); List operatorList = new List(); diff --git a/Assets/Fungus/FungusScript/Scripts/Variable.cs b/Assets/Fungus/FungusScript/Scripts/Variable.cs index b78f45b9..de5e70bf 100644 --- a/Assets/Fungus/FungusScript/Scripts/Variable.cs +++ b/Assets/Fungus/FungusScript/Scripts/Variable.cs @@ -18,7 +18,7 @@ namespace Fungus Global } - public class Variable : ScriptableObject + public class Variable : MonoBehaviour { public VariableScope scope; public string key = "";