Search Issue Tracker
By Design
By Design in 2023.2.X
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
- Multiple errors are thrown in the console while using perforce when moving an asset using shortcuts
- PlayerPropertiesChanged event fires before Player Properties are applied
- Opening Media Pop-out in “Before You Start” Tutorial throws “Styles” and “Styles_Dark” messages in the Console window
- Play Mode Scenario selection/highlight is too long and out of its bounds when the Play Mode Scenario window is opened after maximizing
- Asset name is not shown in the Undo History window when a sprite is modified
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`.
Resolution Note (2023.2.X):
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`.