-
-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unityFramework?.pause(true) throw null pointer exceptions #597
Comments
This code snippet
Where: Under normal conditions (when iOS is not paused), the output is However, under circumstances when iOS is paused, there is a probability that the output will be I have not yet pinpointed the exact moment where this gets lost. |
UniTask Test4 UIWardrobe (Tsl.Ymkj.Partner.UIWardrobe)UniTask Test4 UIWardrobe (Tsl.Ymkj.Partner.UIWardrobe)
The referenced script on this Behaviour (Game Object 'Main Camera') is missing! 2024-06-27 14:03:27 [unity debug] : 收到U3D的消息: {"methodName":"EnterMainScense","content":""} Unloading 2 unused Assets to reduce memory usage. Loaded Objects now: 7630. UniTask Test5 null |
After the line |
Fixes Cysharp#597 Add null reference checks and reinitialize references after resuming Unity to prevent null pointer exceptions in UniTask code snippets. * **AsyncUniTaskMethodBuilder.cs** - Add null reference checks in `SetResult`, `SetException`, `AwaitOnCompleted`, and `AwaitUnsafeOnCompleted` methods. * **PlayerLoopRunner.cs** - Add code to reinitialize references after resuming in `RunCore` method. * **PlayerLoopHelper.cs** - Add code to ensure references are not lost after resuming in `AddAction` and `AddContinuation` methods. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Cysharp/UniTask/issues/597?shareId=XXXX-XXXX-XXXX-XXXX).
When calling unityFramework?.pause(true) to pause Unity from iOS and then calling unityFramework?.pause(false) to resume it, if there are UniTask code snippets that are currently executing, they may throw null pointer exceptions after resuming, while not pausing Unity does not cause this issue.
The text was updated successfully, but these errors were encountered: