diff --git a/Packages/Core/Runtime/Variables/AtomVariable.cs b/Packages/Core/Runtime/Variables/AtomVariable.cs index 6a083910..81f88449 100644 --- a/Packages/Core/Runtime/Variables/AtomVariable.cs +++ b/Packages/Core/Runtime/Variables/AtomVariable.cs @@ -47,7 +47,6 @@ namespace UnityAtoms [SerializeField] [FormerlySerializedAs("Changed")] private E1 _changed; - private bool _changedInstantiatedAtRuntime; public E1 Changed { get @@ -67,7 +66,6 @@ namespace UnityAtoms [SerializeField] [FormerlySerializedAs("ChangedWithHistory")] private E2 _changedWithHistory; - private bool _changedWithHistoryInstantiatedAtRuntime; public E2 ChangedWithHistory { get @@ -156,11 +154,6 @@ namespace UnityAtoms #endif } - private void OnDisable() - { - if (_changedInstantiatedAtRuntime) _changed = null; - if (_changedWithHistoryInstantiatedAtRuntime) _changedWithHistory = null; - } /// /// Set initial values @@ -169,9 +162,6 @@ namespace UnityAtoms { _oldValue = InitialValue; _value = InitialValue; - - _changedInstantiatedAtRuntime = false; - _changedWithHistoryInstantiatedAtRuntime = false; } /// @@ -188,7 +178,7 @@ namespace UnityAtoms } if (_triggerChangedWithHistoryOnOnEnable) { - if(ChangedWithHistory == null) + if (ChangedWithHistory == null) GetOrCreateEvent(); var pair = default(P); @@ -390,7 +380,6 @@ namespace UnityAtoms { _changed = ScriptableObject.CreateInstance(); _changed.name = $"{(String.IsNullOrWhiteSpace(name) ? "" : $"{name}_")}ChangedEvent_Runtime_{typeof(E1)}"; - _changedInstantiatedAtRuntime = true; } return _changed as E; @@ -401,7 +390,6 @@ namespace UnityAtoms { _changedWithHistory = ScriptableObject.CreateInstance(); _changedWithHistory.name = $"{(String.IsNullOrWhiteSpace(name) ? "" : $"{name}_")}ChangedWithHistoryEvent_Runtime_{typeof(E2)}"; - _changedWithHistoryInstantiatedAtRuntime = true; } return _changedWithHistory as E;