Skip to content
Snippets Groups Projects
Commit 00a28224 authored by Heine, Eric R's avatar Heine, Eric R
Browse files

Apparently events can't be fired from inherited classes, so the...

Apparently events can't be fired from inherited classes, so the ScriptableVariable base class now has a protected function to fire its OnValueChanged event.
parent 1dc17826
No related branches found
Tags 0.1.14
No related merge requests found
...@@ -27,9 +27,7 @@ namespace Shared.ScriptableVariables { ...@@ -27,9 +27,7 @@ namespace Shared.ScriptableVariables {
set { set {
if ((value == null && this.value != null) || (value != null && !value.Equals(this.value))) { if ((value == null && this.value != null) || (value != null && !value.Equals(this.value))) {
this.value = value; this.value = value;
if (OnValueChanged != null) { ValueChanged();
OnValueChanged.Invoke();
}
} }
} }
} }
...@@ -39,6 +37,13 @@ namespace Shared.ScriptableVariables { ...@@ -39,6 +37,13 @@ namespace Shared.ScriptableVariables {
Value = defaultValue; Value = defaultValue;
} }
//---------------------------------------------------------------------------
protected void ValueChanged() {
if (OnValueChanged != null) {
OnValueChanged.Invoke();
}
}
#if UNITY_EDITOR #if UNITY_EDITOR
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//Base class for custom editors which expose the Property of ScriptableVariables //Base class for custom editors which expose the Property of 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.13", "version": "0.1.14",
"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