修正UIWindow资源句柄时序导致UI同步显示失效的问题。

This commit is contained in:
ALEXTANG
2023-12-08 10:37:49 +08:00
parent edf4925a7a
commit 1f2d99ddc9

View File

@@ -255,7 +255,8 @@ namespace TEngine
this.userDatas = userDatas; this.userDatas = userDatas;
if (!FromResources) if (!FromResources)
{ {
GameModule.Resource.LoadAssetAsync<GameObject>(location, Handle_Completed, needCache: NeedCache); Handle = GameModule.Resource.LoadAssetAsyncHandle<GameObject>(location, needCache: NeedCache);
Handle.Completed += Handle_Completed;
} }
else else
{ {
@@ -394,13 +395,11 @@ namespace TEngine
{ {
throw new GameFrameworkException("Load uiWindows Failed because AssetObject is null"); throw new GameFrameworkException("Load uiWindows Failed because AssetObject is null");
} }
Handle = handle;
// 实例化对象 // 实例化对象
var panel = handle.InstantiateSync(UIModule.UIRootStatic); var panel = handle.InstantiateSync(UIModule.UIRootStatic);
if (!NeedCache) if (!NeedCache)
{ {
AssetReference.BindAssetReference(panel, handle, AssetName); AssetReference.BindAssetReference(panel, Handle, AssetName);
} }
Handle_Completed(panel); Handle_Completed(panel);
} }