From 14f8f3809c88d5e5b46b8e8f1fccade98d4b27b4 Mon Sep 17 00:00:00 2001 From: Adam Ramberg Date: Tue, 8 Aug 2023 20:23:18 +0200 Subject: [PATCH] Add appropriate UNITY_EDITOR compiler flags --- Packages/Core/Runtime/Events/AtomEvent.cs | 2 ++ Packages/Core/Runtime/ValueLists/AtomValueList.cs | 2 ++ Packages/Core/Runtime/Variables/AtomVariable.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Packages/Core/Runtime/Events/AtomEvent.cs b/Packages/Core/Runtime/Events/AtomEvent.cs index 03562867..c0fd6947 100644 --- a/Packages/Core/Runtime/Events/AtomEvent.cs +++ b/Packages/Core/Runtime/Events/AtomEvent.cs @@ -80,7 +80,9 @@ namespace UnityAtoms // 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 +#if UNITY_EDITOR _instances.Remove(this); +#endif // 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 057b30eb..43d268d3 100644 --- a/Packages/Core/Runtime/ValueLists/AtomValueList.cs +++ b/Packages/Core/Runtime/ValueLists/AtomValueList.cs @@ -74,7 +74,9 @@ namespace UnityAtoms // 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 +#if UNITY_EDITOR _instances.Remove(this); +#endif } #if UNITY_EDITOR diff --git a/Packages/Core/Runtime/Variables/AtomVariable.cs b/Packages/Core/Runtime/Variables/AtomVariable.cs index 8199c62c..20d593bc 100644 --- a/Packages/Core/Runtime/Variables/AtomVariable.cs +++ b/Packages/Core/Runtime/Variables/AtomVariable.cs @@ -160,7 +160,9 @@ namespace UnityAtoms // 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 +#if UNITY_EDITOR _instances.Remove(this); +#endif } ///