BUG: [UiParticleSystem] Using `UnscaledDeltaTime` causes performance freeze on Application Foreground
Unity UI Extensions Bug Report
Describe the bug
In the UiParticleSystem class the following line pSystem.Simulate(Time.unscaledDeltaTime, false, false, true); in the Update method causes freeze, if there is a particle system with looping in the scene, and the app comes back from the background. The reason is the usage of the unscaledDeltaTime , because let's say the game was in background for 1h, then the unscaledDeltaTime is being 3600, and simulation takes for example 20 seconds in the very 1st frame after application resumed. Changing it to DeltaTime solves the issue, but maybe you guys will provide more robust solution , as even though our game doesn't really need to use the unscaledDeltaTime, but maybe others do.
To Reproduce
- Have a particle system in the scene , with looping enabled, and let's say 100 max particles
- Put app into background
- Wait for some time ( freeze duration depends on the time the app was in background, so for noticeable freeze, you can wait 30mins at least)
- Bring back the app to foreground
- Notice the 1st frame hang, because of the long running
pSystem.Simulate(Time.unscaledDeltaTime, false, false, true)method.
Expected behavior
1st frame after application returned from background should not hang
Actual behavior
It hangs :D
Screenshots
Your Setup
-
Operation System:
- [ ] Windows
- [x] MacOs
- [ ] Linux
- [ ] Other
- Unity Version: 2022.3.22f
-
Unity UI Extensions Version
- [ ] 2.3.2