Skip to content

Commit 601b8da

Browse files
committed
fix(FairyGUI): 修复资源句柄未释放导致的内存泄漏
在卸载资源时,如果资源句柄是YooAsset.AssetHandle类型,需要显式调用Release()方法释放句柄,避免内存泄漏
1 parent d21cd64 commit 601b8da

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Runtime/FairyGUIFormHelper.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ public override void ReleaseUIForm(object uiFormAsset, object uiFormInstance, ob
188188

189189
if (uiFormAssetPath.IndexOf(Utility.Asset.Path.BundlesDirectoryName, StringComparison.OrdinalIgnoreCase) >= 0)
190190
{
191+
if (assetHandle is YooAsset.AssetHandle handle)
192+
{
193+
handle.Release();
194+
}
195+
191196
m_AssetComponent.UnloadAsset(uiFormAssetPath);
192197
}
193198
else
@@ -225,4 +230,4 @@ private void Awake()
225230
}
226231
}
227232
}
228-
}
233+
}

0 commit comments

Comments
 (0)