Skip to content

fix(core): convert AsyncOperation to UniTask for Unity 6 compatibility#595

Merged
JasonXuDeveloper merged 2 commits intomasterfrom
fix/unity6-asyncoperation-await
Jan 28, 2026
Merged

fix(core): convert AsyncOperation to UniTask for Unity 6 compatibility#595
JasonXuDeveloper merged 2 commits intomasterfrom
fix/unity6-asyncoperation-await

Conversation

@JasonXuDeveloper
Copy link
Owner

Summary

  • Fix CS0311 compilation error in Unity 6 where UnityEngine.AsyncOperation cannot be directly awaited
  • Convert SceneManager.LoadSceneAsync() to use .ToUniTask() extension method
  • Add git workflow guidelines (branch from master, use PRs for all changes)

Problem

In Unity 6, UnityEngine.AsyncOperation cannot be used as a type parameter for EnumeratorAsyncExtensions.GetAwaiter<T>() because there's no implicit reference conversion to System.Collections.IEnumerator.

Solution

Use the ToUniTask() extension method from Cysharp.Threading.Tasks to convert the AsyncOperation to a UniTask, which can be awaited. This pattern is already used elsewhere in the codebase (e.g., line 145 in the same file).

Test plan

  • Open the project in Unity 6
  • Verify no CS0311 compilation errors
  • Test scene loading error path to ensure fallback scene loads correctly

🤖 Generated with Claude Code

JasonXuDeveloper and others added 2 commits January 29, 2026 09:43
- Always create branches from master, not feature branches
- Never push directly to master, use PRs for all changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
In Unity 6, UnityEngine.AsyncOperation cannot be directly awaited.
Convert to UniTask using .ToUniTask() extension method.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
Copilot AI review requested due to automatic review settings January 28, 2026 22:43
@github-actions github-actions bot added documentation Improvements or additions to documentation core labels Jan 28, 2026
@JasonXuDeveloper JasonXuDeveloper enabled auto-merge (squash) January 28, 2026 22:43
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 fixes a Unity 6 compilation error where UnityEngine.AsyncOperation cannot be directly awaited due to missing implicit reference conversion to System.Collections.IEnumerator. The fix uses the .ToUniTask() extension method, which is the established pattern already used elsewhere in the same file. Additionally, the PR adds git workflow guidelines to ensure proper branching practices and PR-based development workflow.

Changes:

  • Fixed CS0311 compilation error by converting SceneManager.LoadSceneAsync() to use .ToUniTask() in the error handling path
  • Added comprehensive git workflow guidelines covering branching from master and PR-based workflow requirements

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
UnityProject/Packages/com.jasonxudeveloper.jengine.core/Runtime/Bootstrap.Common.cs Converted AsyncOperation to UniTask using .ToUniTask() to fix Unity 6 compilation error
.claude/rules/commit-conventions.md Added git workflow sections for branching from master and PR-only workflow requirements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

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 e8f5cd2 into master Jan 28, 2026
26 checks passed
@JasonXuDeveloper JasonXuDeveloper deleted the fix/unity6-asyncoperation-await branch January 28, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant