Skip to content

fix(core): use synchronous asset loading for AOT metadata#630

Merged
JasonXuDeveloper merged 2 commits intomasterfrom
fix/sync-aot-metadata-loading
Feb 13, 2026
Merged

fix(core): use synchronous asset loading for AOT metadata#630
JasonXuDeveloper merged 2 commits intomasterfrom
fix/sync-aot-metadata-loading

Conversation

@JasonXuDeveloper
Copy link
Owner

Summary

  • Replace LoadAssetAsync + await with LoadAssetSync in LoadMetadataForAOTAssemblies, eliminating N+ frames of unnecessary delay during initialization
  • Change the method from async UniTask to void since no async operations remain
  • Safe because this runs during bootstrap before gameplay begins

Test plan

  • Verify project compiles without errors in Unity 2022.3+
  • Confirm AOT metadata loads correctly on a build with HybridCLR enabled
  • Check initialization timing improvement (fewer frames spent in metadata loading)

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
Copilot AI review requested due to automatic review settings February 13, 2026 10:05
@github-actions github-actions bot added the core label Feb 13, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes the AOT metadata loading process by replacing asynchronous asset loading with synchronous loading, eliminating unnecessary frame delays during bootstrap initialization. The change converts LoadMetadataForAOTAssemblies from an async UniTask method to a void method, using LoadAssetSync instead of LoadAssetAsync + await.

Changes:

  • Replaced YooAssets.LoadAssetAsync with YooAssets.LoadAssetSync for AOT metadata list loading
  • Replaced YooAssets.LoadAssetAsync with YooAssets.LoadAssetSync for individual AOT DLL loading
  • Changed method signature from async UniTask LoadMetadataForAOTAssemblies() to void LoadMetadataForAOTAssemblies()
  • Updated caller to invoke the method synchronously (removed await)

@JasonXuDeveloper JasonXuDeveloper enabled auto-merge (squash) February 13, 2026 10:08
Validate handle.Status before accessing asset objects to prevent
null reference exceptions when sync loads fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
@github-actions
Copy link

github-actions bot commented Feb 13, 2026

Unity Test Results

EditMode: All tests passed
PlayMode: All tests passed

Unity Version: 2022.3.55f1
Project Path: UnityProject

✅ All tests passed! The PR is ready for review.

View workflow run

Click here to view the full workflow run

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: Copilot review found no issues and Unity Tests passed (or were skipped for non-code changes).

@JasonXuDeveloper JasonXuDeveloper merged commit af1168f into master Feb 13, 2026
20 checks passed
@JasonXuDeveloper JasonXuDeveloper deleted the fix/sync-aot-metadata-loading branch February 13, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant