0
Answered

ParticleSystem Simulation Improvement

jgrot 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 1

While debugging my game I noticed that particle system simulation is happening every frame during rewind even when the particle system is not supposed to be playing. Is this expected? Is there a way to store the computed time when the particle system stopped playing, and only begin simulating the system if that time is rewinded to?

E.g. imagine a timeline like this:

0-2 seconds a non looping particle plays, store particle system completed at 2 seconds

2-5 seconds other stuff happens

Rewind for 5 seconds

5-2, no simulation necessary as we're not at 2 seconds

2-0 begin simulation as required per limitation

Right now I am seeing simulation from 5-0.

Chronos Version:
2.4.11
Unity Version:
5.6.3p1
Answered

Hi jgrot,

I apologize for the extremely late reply on this.

I believe I tried that optimization back in the day and it wouldn't work for some reason. 

You can try it yourself by wrapping line 224 of RewindableParticleSystemTimeline.cs with:

if (timeline.timeScale != 0)

Let me know if it works for your needs!