From abfbba7307f2ef31c7b2be4dc19b7b7b9ff2faef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JasonXuDeveloper=20-=20=E5=82=91?= Date: Fri, 13 Feb 2026 21:05:11 +1100 Subject: [PATCH 1/2] fix(core): use synchronous asset loading for AOT metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LoadMetadataForAOTAssemblies used LoadAssetAsync + await per file, causing N+ frames of unnecessary delay during initialization. Since this runs before gameplay, synchronous loading is safe and eliminates the frame-per-file overhead. Co-Authored-By: Claude Opus 4.6 Signed-off-by: JasonXuDeveloper - 傑 --- .../Runtime/Bootstrap.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.core/Runtime/Bootstrap.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.core/Runtime/Bootstrap.cs index b7057f93..85b3ef23 100644 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.core/Runtime/Bootstrap.cs +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.core/Runtime/Bootstrap.cs @@ -152,10 +152,9 @@ private async UniTask SetUpDynamicSecret() Debug.Log("SetUpDynamicSecret end"); } - private async UniTask LoadMetadataForAOTAssemblies() + private void LoadMetadataForAOTAssemblies() { - var aotListHandle = YooAssets.LoadAssetAsync(aotDllListFilePath); - await aotListHandle.Task; + var aotListHandle = YooAssets.LoadAssetSync(aotDllListFilePath); TextAsset aotDataAsset = aotListHandle.GetAssetObject(); var aotDllList = NinoDeserializer.Deserialize>(aotDataAsset.bytes); aotListHandle.Release(); @@ -168,8 +167,7 @@ private async UniTask LoadMetadataForAOTAssemblies() continue; } - var handle = YooAssets.LoadAssetAsync(aotDllName); - await handle.Task; + var handle = YooAssets.LoadAssetSync(aotDllName); byte[] dllBytes = handle.GetAssetObject().bytes; var err = RuntimeApi.LoadMetadataForAOTAssembly(dllBytes, HomologousImageMode.SuperSet); Debug.Log($"LoadMetadataForAOTAssembly:{aotDllName}. ret:{err}"); @@ -293,7 +291,7 @@ await Prompt.ShowDialogAsync(t.dialogTitleNotice, // First supplement metadata updateStatusText.text = text.loadingCode; - await LoadMetadataForAOTAssemblies(); + LoadMetadataForAOTAssemblies(); // Set dynamic key updateStatusText.text = text.decryptingResources; await SetUpDynamicSecret(); From bc80fc8597a39c98ffcf08ca896c2d125d950533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JasonXuDeveloper=20-=20=E5=82=91?= Date: Fri, 13 Feb 2026 21:09:45 +1100 Subject: [PATCH 2/2] fix(core): add status checks after synchronous asset loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Validate handle.Status before accessing asset objects to prevent null reference exceptions when sync loads fail. Co-Authored-By: Claude Opus 4.6 Signed-off-by: JasonXuDeveloper - 傑 --- .../Runtime/Bootstrap.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.core/Runtime/Bootstrap.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.core/Runtime/Bootstrap.cs index 85b3ef23..42953f45 100644 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.core/Runtime/Bootstrap.cs +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.core/Runtime/Bootstrap.cs @@ -155,6 +155,13 @@ private async UniTask SetUpDynamicSecret() private void LoadMetadataForAOTAssemblies() { var aotListHandle = YooAssets.LoadAssetSync(aotDllListFilePath); + if (aotListHandle.Status != EOperationStatus.Succeed) + { + Debug.LogError($"Failed to load AOT DLL list: {aotListHandle.LastError}"); + aotListHandle.Release(); + return; + } + TextAsset aotDataAsset = aotListHandle.GetAssetObject(); var aotDllList = NinoDeserializer.Deserialize>(aotDataAsset.bytes); aotListHandle.Release(); @@ -168,6 +175,13 @@ private void LoadMetadataForAOTAssemblies() } var handle = YooAssets.LoadAssetSync(aotDllName); + if (handle.Status != EOperationStatus.Succeed) + { + Debug.LogError($"Failed to load AOT DLL {aotDllName}: {handle.LastError}"); + handle.Release(); + continue; + } + byte[] dllBytes = handle.GetAssetObject().bytes; var err = RuntimeApi.LoadMetadataForAOTAssembly(dllBytes, HomologousImageMode.SuperSet); Debug.Log($"LoadMetadataForAOTAssembly:{aotDllName}. ret:{err}");