Rewinding Particle System Help
I'm trying to rewind my Particle System. I've been able to rewind it just fine as long as the particle's lifespan hasn't been reached yet. When it has, it's seems to randomize on rewind. As is seen on the image below:
http://i.imgur.com/rwZN1gQ.gifv
Note how the rewind gets randomized when the PlaybackTime reaches 0. Does anyone know a way to get around this?
Here is the relevant code I'm using now:
public void Update() {
if (timeScale > 0)
Continue();
else if (timeScale < 0)
Rewind();
}
protected void Continue() {
prevTime = particleLifeSpan;
particleLifeSpan = particle.time;
particle.Simulate(timeline.TimeScale * Time.deltaTime, true, false);
}
protected void Rewind() {
particleLifeSpan += timeline.TimeScale * Time.deltaTime;
if (particleLifeSpan <= 0)
particleLifeSpan = particle.main.duration;
particle.Simulate(particleLifeSpan, true, true);
}
Your answer
Follow this Question
Related Questions
Turn on and off ParticleSystem and LineRenderer on same object at the same time 1 Answer
Particle System Mask adjust Particle Size 0 Answers
Particle System Not Visible Without Scene Window Viewing Origin 0 Answers
changing the radius of a particle system with unity script 1 Answer
Moving particle system via script causes choppy movement in build but works fine in pay mode 1 Answer