com.unity.uiextensions icon indicating copy to clipboard operation
com.unity.uiextensions copied to clipboard

BUG: [UiParticleSystem] Using `UnscaledDeltaTime` causes performance freeze on Application Foreground

Open gagbaghdas opened this issue 11 months ago • 0 comments

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

  1. Have a particle system in the scene , with looping enabled, and let's say 100 max particles
  2. Put app into background
  3. 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)
  4. Bring back the app to foreground
  5. 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

Additional context

gagbaghdas avatar Jan 21 '25 11:01 gagbaghdas