Skip to content
Snippets Groups Projects
Commit ee65ecfd authored by Michael Guerrero's avatar Michael Guerrero
Browse files

Fixed scriptable object values not resetting themselves leading to unwanted execution.

parent f62f7166
No related branches found
Tags 0.1.11
No related merge requests found
...@@ -8,7 +8,12 @@ namespace Shared.ScriptableVariables { ...@@ -8,7 +8,12 @@ namespace Shared.ScriptableVariables {
public delegate void GameEventRaised(); public delegate void GameEventRaised();
public event GameEventRaised OnRaised; public event GameEventRaised OnRaised;
int lastEventRaisedFrame = 0; int lastEventRaisedFrame = -1;
//---------------------------------------------------------------------------
void OnDisable() {
lastEventRaisedFrame = -1;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
[ContextMenu("Raise")] [ContextMenu("Raise")]
...@@ -32,14 +37,18 @@ namespace Shared.ScriptableVariables { ...@@ -32,14 +37,18 @@ namespace Shared.ScriptableVariables {
public delegate void GameEventRaised(T value); public delegate void GameEventRaised(T value);
public event GameEventRaised OnRaised; public event GameEventRaised OnRaised;
int lastEventRaisedFrame = 0; int lastEventRaisedFrame = -1;
//---------------------------------------------------------------------------
void OnDisable() {
lastEventRaisedFrame = -1;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
public void Raise(T value) { public void Raise(T value) {
if (OnRaised != null) { if (OnRaised != null) {
OnRaised(value); OnRaised(value);
} }
lastEventRaisedFrame = Time.frameCount; lastEventRaisedFrame = Time.frameCount;
} }
...@@ -51,3 +60,4 @@ namespace Shared.ScriptableVariables { ...@@ -51,3 +60,4 @@ namespace Shared.ScriptableVariables {
} }
} }
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "com.futuretech.shared", "name": "com.futuretech.shared",
"displayName": "FutureTech Shared", "displayName": "FutureTech Shared",
"description": "Contains shared items such as the Scriptable Variables.", "description": "Contains shared items such as the Scriptable Variables.",
"version": "0.1.10", "version": "0.1.11",
"unity": "2018.3", "unity": "2018.3",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment