Search Issue Tracker
By Design
Votes
0
Found in
2023.1.0b20
2023.2.0a18
Issue ID
UUM-37783
Regression
No
NextFrameAsync does not return when Time.timeScale is set to zero the second time
How to reproduce:
1. Open the “AwaitableTimeReproduction.zip“ project
2. Open the “SampleScene“
3. Enter Play mode
4. Click the "Start" button
5. Click the "Resume" button
6. Click the "Pause" button
Expected result: The counter in front of the “Frames“ text stops counting frames
Actual result: The counter in front of the “Frames“ text continues to count frames
Reproducible with: 2023.1.0b20, 2023.2.0a18
Could not test with: 2021.3.27f1, 2022.3.1f1 (Awaitable functions are not available)
Reproducible on: Windows 10, Windows 11
Note: Reproducible in Player.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Crash on when D3D12RenderPass::SetupDeviceResources when opening FBX animation preview
- Serialization errors are thrown when "com.unity.render-pipelines.core" is added as a custom package and Graphics window is opened
- Character Joints unexpectedly rotate when a ragdoll is created using the Ragdoll Wizard
- Crash on GfxDeviceD3D11Base::DrawBuffersBatchMode when rendering the Scene view
- The shared EditorBuildSettings.asset file of symlinked projects is not updated when changing the order of the Scenes in Build Settings in one of the projects
Resolution Note:
Unity's framerate is not affected by Time.timeScale, therefore, awaiting for next frame is not affected by it too. Even if timeScale is 0 unity will still render game frames thus frame counting loop will count new frames.
However, things work a bit differently with physics updates. Not only do they happen on set time intervals but are also affected by timeScale property.
So this case is not an engine bug and the intention of users' code can be achieved in multiple ways:
* If awaitable frame counter is needed, we would suggest introducing a variable that's representing frame counters state(paused or not paused) and counting frames only when frame counter is not paused.
* Otherwise, if one needs to rely on timeScale property to stop counting frames or time, we suggest adapting counting method to await for `Awaitable.FixedUpdateAsync`.