diff --git a/My project/Assets/FlowScope/Runtime/UI/UIManager.cs b/My project/Assets/FlowScope/Runtime/UI/UIManager.cs index 4078f5e..27d9c5b 100644 --- a/My project/Assets/FlowScope/Runtime/UI/UIManager.cs +++ b/My project/Assets/FlowScope/Runtime/UI/UIManager.cs @@ -92,7 +92,7 @@ namespace FlowScope.UI { if (instance != null) { - UnityEngine.Object.DestroyImmediate(instance); + UnityEngine.Object.Destroy(instance); } handle.Dispose(); @@ -184,7 +184,7 @@ namespace FlowScope.UI } layer.RemoveCached(record.PanelType); - UnityEngine.Object.DestroyImmediate(record.Panel.gameObject); + UnityEngine.Object.Destroy(record.Panel.gameObject); record.Handle.Dispose(); } diff --git a/My project/Assets/FlowScope/Tests/PlayMode/UI/UIManagerTests.cs b/My project/Assets/FlowScope/Tests/PlayMode/UI/UIManagerTests.cs index ad7fae8..7dca89e 100644 --- a/My project/Assets/FlowScope/Tests/PlayMode/UI/UIManagerTests.cs +++ b/My project/Assets/FlowScope/Tests/PlayMode/UI/UIManagerTests.cs @@ -104,8 +104,9 @@ namespace FlowScope.Tests.PlayMode.UI Assert.That(panel.UnbindCount, Is.EqualTo(1)); Assert.That(handle.IsDisposed, Is.True); - Assert.That(panel == null, Is.True); Assert.That(manager.IsOpen(), Is.False); + yield return null; + Assert.That(panel == null, Is.True); } [UnityTest] @@ -172,6 +173,7 @@ namespace FlowScope.Tests.PlayMode.UI () => manager.OpenAsync(new TestViewModel("boom"), CancellationToken.None)); Assert.That(resources.Handles[0].IsDisposed, Is.True); + yield return null; Assert.That(canvas.transform.childCount, Is.EqualTo(0)); Assert.That(manager.IsOpen(), Is.False); }