diff --git a/Scriptable Variables/Events/GameEvent.cs b/Scriptable Variables/Events/GameEvent.cs index 49cd47bcad9a0ce12ca81538bc7c39045c53f929..4ea153650ec45a5e8e4274d8c35a081dbc899b80 100644 --- a/Scriptable Variables/Events/GameEvent.cs +++ b/Scriptable Variables/Events/GameEvent.cs @@ -8,7 +8,12 @@ namespace Shared.ScriptableVariables { public delegate void GameEventRaised(); public event GameEventRaised OnRaised; - int lastEventRaisedFrame = 0; + int lastEventRaisedFrame = -1; + + //--------------------------------------------------------------------------- + void OnDisable() { + lastEventRaisedFrame = -1; + } //--------------------------------------------------------------------------- [ContextMenu("Raise")] @@ -32,14 +37,18 @@ namespace Shared.ScriptableVariables { public delegate void GameEventRaised(T value); public event GameEventRaised OnRaised; - int lastEventRaisedFrame = 0; + int lastEventRaisedFrame = -1; + + //--------------------------------------------------------------------------- + void OnDisable() { + lastEventRaisedFrame = -1; + } //--------------------------------------------------------------------------- public void Raise(T value) { if (OnRaised != null) { OnRaised(value); } - lastEventRaisedFrame = Time.frameCount; } @@ -51,3 +60,4 @@ namespace Shared.ScriptableVariables { } } } + diff --git a/package.json b/package.json index 892816e6237b5ac129b46cb0c81b9f9adc274cd0..8b0923feb6d969b64da34f3ad6a74f01c9ef06b6 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.futuretech.shared", "displayName": "FutureTech Shared", "description": "Contains shared items such as the Scriptable Variables.", - "version": "0.1.10", + "version": "0.1.11", "unity": "2018.3", "license": "MIT", "repository": {