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
- Crash on CollectAllSceneManagerAndObjectIDs when opening a specific Scene
- GPU device suspended error when replaying a video in the Video Player with NVIDIA Vertical Sync set to Fast
- GPU device suspended error when replaying a video in the Video Player with NVIDIA Vertical Sync set to Fast
- SetComponentEnabled uses class instead of struct when constraining Enableable Component type
- [iOS] Application.deepLinkActivated does not get invoked while app is running when UIApplicationSceneManifest is added in Info.plist
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`.