修正 UIManager 运行时销毁逻辑
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<ExplicitPathPanel>(), Is.False);
|
||||
yield return null;
|
||||
Assert.That(panel == null, Is.True);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
@@ -172,6 +173,7 @@ namespace FlowScope.Tests.PlayMode.UI
|
||||
() => manager.OpenAsync<ThrowingBindPanel, TestViewModel>(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<ThrowingBindPanel>(), Is.False);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user