- Home /
ParticleSystem.Stop() doesn't stop ParticleSystem
When I call particles.Stop()
, or particles.playOnAwake = false
, the ParticleSystem still emits particles, and still returns true
for particles.isPlaying
.
What am I doing wrong?
public class ParticleTester : MonoBehaviour {
void Awake() {
ParticleSystem particles = GetComponent<ParticleSystem>();
particles.Stop();
Debug.Log(particles.isStopped + " " + particles.isPlaying);
}
}
Answer by Tekksin · Sep 23, 2018 at 01:50 PM
I'm having the same problem. Did you ever figure this out?
Hey, so I discovered something you might be interested in.
When you say "particles.stop" the particle system continues for its schedule start time / duration before stopping. You have to use
ParticleSystem.Stop (true, ParticleSystemStopBehavior.StopEmittingAndClear);
Which will stop the system entirely. Anything you want to finish (like a trail or something), put it in its own particle system, appropriate the start time and duration appropriately, and then just run ParticleSystem.Stop(true).
And this is me thinking out loud, if you want the trail to continue, use false ins$$anonymous$$d of true before the stop behavior command, and leave the trail and stuff as a child of the parent you want to stop immediately... In fact, lemme try that, now..........Yes! So using false will allow the children to complete their behavior, while true will end them all instantly. I'm going to stick with my previous method for personal reasons, but if you wanna do things more simply, that would be the way to do it.
This drove me nuts! Unity's clarifications on the particle system is so underdeveloped it's scary, but at least they have these forums so we can remedy things.