fix(core): convert AsyncOperation to UniTask for Unity 6 compatibility#595
fix(core): convert AsyncOperation to UniTask for Unity 6 compatibility#595JasonXuDeveloper merged 2 commits intomasterfrom
Conversation
- 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>
There was a problem hiding this comment.
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.
Unity Test Results✅ EditMode: All tests passed Unity Version: 2022.3.55f1 ✅ All tests passed! The PR is ready for review. View workflow run |
Summary
UnityEngine.AsyncOperationcannot be directly awaitedSceneManager.LoadSceneAsync()to use.ToUniTask()extension methodProblem
In Unity 6,
UnityEngine.AsyncOperationcannot be used as a type parameter forEnumeratorAsyncExtensions.GetAwaiter<T>()because there's no implicit reference conversion toSystem.Collections.IEnumerator.Solution
Use the
ToUniTask()extension method fromCysharp.Threading.Tasksto convert theAsyncOperationto aUniTask, which can be awaited. This pattern is already used elsewhere in the codebase (e.g., line 145 in the same file).Test plan
🤖 Generated with Claude Code