From 108ad1a2d8a9de3c2412e5686bb69d2b3a3adf60 Mon Sep 17 00:00:00 2001 From: Oliver Biwer Date: Thu, 3 Aug 2023 19:16:59 +0200 Subject: [PATCH] removed the dead-reference handling (#417) - this will be addressed in (#421) compacted the Playmode state change --- Packages/Core/Runtime/Events/AtomEvent.cs | 11 ++--------- Packages/Core/Runtime/ValueLists/AtomValueList.cs | 10 ---------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/Packages/Core/Runtime/Events/AtomEvent.cs b/Packages/Core/Runtime/Events/AtomEvent.cs index de87600f..e7661c46 100644 --- a/Packages/Core/Runtime/Events/AtomEvent.cs +++ b/Packages/Core/Runtime/Events/AtomEvent.cs @@ -62,15 +62,8 @@ namespace UnityAtoms #if UNITY_EDITOR private static void HandlePlayModeStateChange(PlayModeStateChange state) { - if (state == PlayModeStateChange.ExitingEditMode) // BEFORE any GO is initialized: - { - foreach (var instance in _instances) - { - instance._replayBuffer.Clear(); - instance.UnregisterAll(); - } - } - else if (state == PlayModeStateChange.EnteredEditMode) // AFTER Playmode stopped + if (state == PlayModeStateChange.ExitingEditMode // BEFORE any GO is initialized: + || state == PlayModeStateChange.EnteredEditMode) // AFTER Playmode stopped { foreach (var instance in _instances) { diff --git a/Packages/Core/Runtime/ValueLists/AtomValueList.cs b/Packages/Core/Runtime/ValueLists/AtomValueList.cs index a70d6e09..ef165fe9 100644 --- a/Packages/Core/Runtime/ValueLists/AtomValueList.cs +++ b/Packages/Core/Runtime/ValueLists/AtomValueList.cs @@ -74,11 +74,6 @@ namespace UnityAtoms { foreach (var instance in _instances) { - if (instance == null) - { - _instances.Remove(instance); - continue; - } if(instance._startCleared) instance.list.Clear(); instance._initial = instance.list.ToList(); } @@ -87,11 +82,6 @@ namespace UnityAtoms { foreach (var instance in _instances) { - if (instance == null) // might be for UnityEngine.Objects - { - _instances.Remove(instance); - continue; - } instance.list = instance._initial; } }