From 00a28224e8eb17dcd2f7c658cdc495531c90ef12 Mon Sep 17 00:00:00 2001 From: Eric Heine <erheine@nps.edu> Date: Mon, 29 Jul 2019 13:43:55 -0700 Subject: [PATCH] Apparently events can't be fired from inherited classes, so the ScriptableVariable base class now has a protected function to fire its OnValueChanged event. --- .../Variables/Base Types/ScriptableVariable.cs | 11 ++++++++--- package.json | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Scriptable Variables/Variables/Base Types/ScriptableVariable.cs b/Scriptable Variables/Variables/Base Types/ScriptableVariable.cs index 59162d2..c497733 100644 --- a/Scriptable Variables/Variables/Base Types/ScriptableVariable.cs +++ b/Scriptable Variables/Variables/Base Types/ScriptableVariable.cs @@ -27,9 +27,7 @@ namespace Shared.ScriptableVariables { set { if ((value == null && this.value != null) || (value != null && !value.Equals(this.value))) { this.value = value; - if (OnValueChanged != null) { - OnValueChanged.Invoke(); - } + ValueChanged(); } } } @@ -39,6 +37,13 @@ namespace Shared.ScriptableVariables { Value = defaultValue; } + //--------------------------------------------------------------------------- + protected void ValueChanged() { + if (OnValueChanged != null) { + OnValueChanged.Invoke(); + } + } + #if UNITY_EDITOR //----------------------------------------------------------------------------- //Base class for custom editors which expose the Property of ScriptableVariables diff --git a/package.json b/package.json index ff5154a..80847a3 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.13", + "version": "0.1.14", "unity": "2018.3", "license": "MIT", "repository": { -- GitLab