removed ondisable method, to fix #349 (#369)

* removed ondisable method, to fix #349

* Remove _changed and _changedInstantiatedAtRuntime since they are not used anymore

Co-authored-by: Adam Ramberg <adam@mambojambostudios.com>
This commit is contained in:
Soraphis 2022-10-23 22:34:12 +02:00 committed by GitHub
parent b2e302498d
commit b457ac386f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
/// <summary>
/// Set initial values
@ -169,9 +162,6 @@ namespace UnityAtoms
{
_oldValue = InitialValue;
_value = InitialValue;
_changedInstantiatedAtRuntime = false;
_changedWithHistoryInstantiatedAtRuntime = false;
}
/// <summary>
@ -188,7 +178,7 @@ namespace UnityAtoms
}
if (_triggerChangedWithHistoryOnOnEnable)
{
if(ChangedWithHistory == null)
if (ChangedWithHistory == null)
GetOrCreateEvent<E2>();
var pair = default(P);
@ -390,7 +380,6 @@ namespace UnityAtoms
{
_changed = ScriptableObject.CreateInstance<E1>();
_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<E2>();
_changedWithHistory.name = $"{(String.IsNullOrWhiteSpace(name) ? "" : $"{name}_")}ChangedWithHistoryEvent_Runtime_{typeof(E2)}";
_changedWithHistoryInstantiatedAtRuntime = true;
}
return _changedWithHistory as E;