Skip to content

Commit 129a244

Browse files
committed
fix(UI): 修复组件释放时未正确清理的问题
在关闭UI时,确保组件从父节点移除并正确释放。同时优化UIManager中组件的释放逻辑,改为使用对象池进行回收 GameFrameX/GameFrameX.Unity#36
1 parent 68cebb0 commit 129a244

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Runtime/FairyGUIFormHelper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ public override void ReleaseUIForm(object uiFormAsset, object uiFormInstance)
135135
{
136136
if (uiFormInstance is GComponent component)
137137
{
138+
component.RemoveFromParent();
139+
component.Remove();
138140
component.Dispose();
139141
}
140142
}

Runtime/UIManager.Close.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ protected override void RecycleUIForm(IUIForm uiForm, bool isDispose = false)
6767

6868
if (isDispose)
6969
{
70-
component.RemoveFromParent();
71-
component.Remove();
72-
component.Dispose();
70+
m_InstancePool.ReleaseObject(component);
7371
}
7472
}
7573

0 commit comments

Comments
 (0)