diff --git a/Packages/Core/Runtime/Events/AtomEvent.cs b/Packages/Core/Runtime/Events/AtomEvent.cs index fe74c798..03562867 100644 --- a/Packages/Core/Runtime/Events/AtomEvent.cs +++ b/Packages/Core/Runtime/Events/AtomEvent.cs @@ -76,6 +76,10 @@ namespace UnityAtoms private void OnDisable() { + // NOTE: This will not be called when deleting the Atom from the editor. + // Therefore, there might still be null instances, but even though not ideal, + // it should not cause any problems. + // More info: https://issuetracker.unity3d.com/issues/ondisable-and-ondestroy-methods-are-not-called-when-a-scriptableobject-is-deleted-manually-in-project-window _instances.Remove(this); // Clear all delegates when exiting play mode UnregisterAll(); diff --git a/Packages/Core/Runtime/ValueLists/AtomValueList.cs b/Packages/Core/Runtime/ValueLists/AtomValueList.cs index 52bb496c..057b30eb 100644 --- a/Packages/Core/Runtime/ValueLists/AtomValueList.cs +++ b/Packages/Core/Runtime/ValueLists/AtomValueList.cs @@ -70,6 +70,10 @@ namespace UnityAtoms private void OnDisable() { + // NOTE: This will not be called when deleting the Atom from the editor. + // Therefore, there might still be null instances, but even though not ideal, + // it should not cause any problems. + // More info: https://issuetracker.unity3d.com/issues/ondisable-and-ondestroy-methods-are-not-called-when-a-scriptableobject-is-deleted-manually-in-project-window _instances.Remove(this); } diff --git a/Packages/Core/Runtime/Variables/AtomVariable.cs b/Packages/Core/Runtime/Variables/AtomVariable.cs index fabafa5f..8199c62c 100644 --- a/Packages/Core/Runtime/Variables/AtomVariable.cs +++ b/Packages/Core/Runtime/Variables/AtomVariable.cs @@ -156,6 +156,10 @@ namespace UnityAtoms private void OnDisable() { + // NOTE: This will not be called when deleting the Atom from the editor. + // Therefore, there might still be null instances, but even though not ideal, + // it should not cause any problems. + // More info: https://issuetracker.unity3d.com/issues/ondisable-and-ondestroy-methods-are-not-called-when-a-scriptableobject-is-deleted-manually-in-project-window _instances.Remove(this); }