Skip to content

Commit fa0c5ee

Browse files
committed
fix(UI): 根据资源路径选择正确的资源卸载方式
避免非Bundle资源错误调用UnloadAsset导致异常,改为使用Resources.UnloadAsset
1 parent cbda089 commit fa0c5ee

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Runtime/UGUIFormHelper.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,15 @@ public override IUIForm CreateUIForm(object uiFormInstance, Type uiFormType, obj
143143
/// <param name="uiFormAssetPath">界面资源路径。</param>
144144
public override void ReleaseUIForm(object uiFormAsset, object uiFormInstance, object assetHandle, string uiFormAssetPath)
145145
{
146-
m_AssetComponent.UnloadAsset(uiFormAssetPath);
146+
if (uiFormAssetPath.IndexOf(Utility.Asset.Path.BundlesDirectoryName, StringComparison.OrdinalIgnoreCase) >= 0)
147+
{
148+
m_AssetComponent.UnloadAsset(uiFormAssetPath);
149+
}
150+
else
151+
{
152+
UnityEngine.Resources.UnloadAsset((Object)uiFormInstance);
153+
}
154+
147155
Destroy((Object)uiFormInstance);
148156
}
149157

0 commit comments

Comments
 (0)