diff --git a/Assets/Fungus/Scripts/Components/Variable.cs b/Assets/Fungus/Scripts/Components/Variable.cs index ce4ef763..66841e1f 100644 --- a/Assets/Fungus/Scripts/Components/Variable.cs +++ b/Assets/Fungus/Scripts/Components/Variable.cs @@ -234,7 +234,7 @@ namespace Fungus if (Value != null) return Value.ToString(); else - return string.Empty; + return "Null"; } protected virtual void Start() @@ -246,7 +246,7 @@ namespace Fungus //Apply to get from base system.object to T public override void Apply(SetOperator op, object value) { - if(value is T) + if(value is T || value == null) { Apply(op, (T)value); } @@ -277,7 +277,7 @@ namespace Fungus //Apply to get from base system.object to T public override bool Evaluate(CompareOperator op, object value) { - if (value is T) + if (value is T || value == null) { return Evaluate(op, (T)value); } @@ -301,10 +301,10 @@ namespace Fungus switch (compareOperator) { case CompareOperator.Equals: - condition = Value.Equals(value); + condition = Equals(Value, value);// Value.Equals(value); break; case CompareOperator.NotEquals: - condition = !Value.Equals(value); + condition = !Equals(Value, value); break; default: Debug.LogError("The " + compareOperator.ToString() + " comparison operator is not valid."); diff --git a/Assets/Fungus/Scripts/Utils/AllVariableTypes.cs b/Assets/Fungus/Scripts/Utils/AllVariableTypes.cs index d766a589..79f7dbe0 100644 --- a/Assets/Fungus/Scripts/Utils/AllVariableTypes.cs +++ b/Assets/Fungus/Scripts/Utils/AllVariableTypes.cs @@ -285,7 +285,7 @@ namespace Fungus { return ta.DescFunc(this); } - return string.Empty; + return "Null"; } public bool Compare(CompareOperator compareOperator, ref bool compareResult) diff --git a/Assets/Fungus/Scripts/VariableTypes/AnimatorVariable.cs b/Assets/Fungus/Scripts/VariableTypes/AnimatorVariable.cs index e5797722..97ca4b16 100644 --- a/Assets/Fungus/Scripts/VariableTypes/AnimatorVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/AnimatorVariable.cs @@ -49,7 +49,7 @@ namespace Fungus { if (animatorRef == null) { - return animatorVal != null ? animatorVal.ToString() : string.Empty; + return animatorVal != null ? animatorVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/AudioSourceVariable.cs b/Assets/Fungus/Scripts/VariableTypes/AudioSourceVariable.cs index 37d44fc9..76f6cb6a 100644 --- a/Assets/Fungus/Scripts/VariableTypes/AudioSourceVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/AudioSourceVariable.cs @@ -49,7 +49,7 @@ namespace Fungus { if (audioSourceRef == null) { - return audioSourceVal != null ? audioSourceVal.ToString() : string.Empty; + return audioSourceVal != null ? audioSourceVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/CollectionVariable.cs b/Assets/Fungus/Scripts/VariableTypes/CollectionVariable.cs index 018e1955..b88aef31 100644 --- a/Assets/Fungus/Scripts/VariableTypes/CollectionVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/CollectionVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (collectionRef == null) { - return collectionVal != null ? collectionVal.ToString() : string.Empty; + return collectionVal != null ? collectionVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/Collider2DVariable.cs b/Assets/Fungus/Scripts/VariableTypes/Collider2DVariable.cs index 9c0c7fcd..6158ec6a 100644 --- a/Assets/Fungus/Scripts/VariableTypes/Collider2DVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/Collider2DVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (collider2DRef == null) { - return collider2DVal != null ? collider2DVal.ToString() : string.Empty; + return collider2DVal != null ? collider2DVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/ColliderVariable.cs b/Assets/Fungus/Scripts/VariableTypes/ColliderVariable.cs index 1643e795..7d2e43ed 100644 --- a/Assets/Fungus/Scripts/VariableTypes/ColliderVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/ColliderVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (colliderRef == null) { - return colliderVal != null ? colliderVal.ToString() : string.Empty; + return colliderVal != null ? colliderVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/GameObjectVariable.cs b/Assets/Fungus/Scripts/VariableTypes/GameObjectVariable.cs index e04b6d68..c5a7821e 100644 --- a/Assets/Fungus/Scripts/VariableTypes/GameObjectVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/GameObjectVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (gameObjectRef == null) { - return gameObjectVal != null ? gameObjectVal.ToString() : string.Empty; + return gameObjectVal != null ? gameObjectVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/MaterialVariable.cs b/Assets/Fungus/Scripts/VariableTypes/MaterialVariable.cs index c24a168f..f35a122f 100644 --- a/Assets/Fungus/Scripts/VariableTypes/MaterialVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/MaterialVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (materialRef == null) { - return materialVal != null ? materialVal.ToString() : string.Empty; + return materialVal != null ? materialVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/ObjectVariable.cs b/Assets/Fungus/Scripts/VariableTypes/ObjectVariable.cs index a0d7778e..8e732334 100644 --- a/Assets/Fungus/Scripts/VariableTypes/ObjectVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/ObjectVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (objectRef == null) { - return objectVal != null ? objectVal.ToString() : string.Empty; + return objectVal != null ? objectVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/Rigidbody2DVariable.cs b/Assets/Fungus/Scripts/VariableTypes/Rigidbody2DVariable.cs index b1a9e5b0..6cfca726 100644 --- a/Assets/Fungus/Scripts/VariableTypes/Rigidbody2DVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/Rigidbody2DVariable.cs @@ -49,7 +49,7 @@ namespace Fungus { if (rigidbody2DRef == null) { - return rigidbody2DVal != null ? rigidbody2DVal.ToString() : string.Empty; + return rigidbody2DVal != null ? rigidbody2DVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/RigidbodyVariable.cs b/Assets/Fungus/Scripts/VariableTypes/RigidbodyVariable.cs index 5764fd66..33a2495d 100644 --- a/Assets/Fungus/Scripts/VariableTypes/RigidbodyVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/RigidbodyVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (rigidbodyRef == null) { - return rigidbodyVal != null ? rigidbodyVal.ToString() : string.Empty; + return rigidbodyVal != null ? rigidbodyVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/SpriteVariable.cs b/Assets/Fungus/Scripts/VariableTypes/SpriteVariable.cs index 16d5c304..dc0afbec 100644 --- a/Assets/Fungus/Scripts/VariableTypes/SpriteVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/SpriteVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (spriteRef == null) { - return spriteVal != null ? spriteVal.ToString() : string.Empty; + return spriteVal != null ? spriteVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/TextureVariable.cs b/Assets/Fungus/Scripts/VariableTypes/TextureVariable.cs index 5a230339..b11a1242 100644 --- a/Assets/Fungus/Scripts/VariableTypes/TextureVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/TextureVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (textureRef == null) { - return textureVal != null ? textureVal.ToString() : string.Empty; + return textureVal != null ? textureVal.ToString() : "Null"; } else { diff --git a/Assets/Fungus/Scripts/VariableTypes/TransformVariable.cs b/Assets/Fungus/Scripts/VariableTypes/TransformVariable.cs index 50407baf..b8eb6746 100644 --- a/Assets/Fungus/Scripts/VariableTypes/TransformVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/TransformVariable.cs @@ -50,7 +50,7 @@ namespace Fungus { if (transformRef == null) { - return transformVal != null ? transformVal.ToString() : string.Empty; + return transformVal != null ? transformVal.ToString() : "Null"; } else {