Skip to content

Commit 8b2d173

Browse files
committed
fix(ui): 卸载资源前检查路径是否存在
在调用 UnloadAsset 之前增加 HasAssetPath 检查,避免卸载未加载的资源导致异常。
1 parent 7f579dd commit 8b2d173

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Runtime/UGUIFormHelper.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ public override void ReleaseUIForm(object uiFormAsset, object uiFormInstance, ob
184184
Destroy((UnityEngine.Object)uiFormInstance);
185185
if (uiFormAssetPath.IndexOf(Utility.Asset.Path.BundlesDirectoryName, StringComparison.OrdinalIgnoreCase) >= 0)
186186
{
187-
m_AssetComponent.UnloadAsset(uiFormAssetPath);
187+
if (m_AssetComponent.HasAssetPath(uiFormAssetPath))
188+
{
189+
m_AssetComponent.UnloadAsset(uiFormAssetPath);
190+
}
188191
}
189192
else
190193
{

0 commit comments

Comments
 (0)