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
- Font character thickness does not adjust properly in UI Toolkit text when changing Bold Weight in Font Asset
- Multiple "[...] is inaccessible due to its protection level" errors are thrown when opening project with Unity Version Control installed
- Sorting icons are tiny and misaligned in Import Activity window
- The Undo system does not record HideFlags.HideInHierarchy changes
- [Linux] Bug Reporter window is in Light mode when the Editor theme is Dark mode
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`.