Differences between particleSystem.enableEmission vs particleSystem.Stop() ?

I have a strange situation where I’m trying to use the Stop() method on my particleSystem to no effect. It keeps playing.

However, I can set the enableEmission property to false and it works.

It’s a very simple particle – no child particle systems, no prewarm, no Play On Awake, looping is On, and there’s no other code that’s turning it right back on after I tried to Stop it.

Whats going on?

Manny

Sorry I don’t have a concrete answer for you, I couldn’t reproduce the problem but here’s some insights into the particle system that might give you some clues about your issue…

enableEmission and Play/Stop are two separate things with similar results sometimes.

Play() starts the particle system creating particles and managing them throughout their lifetime.
Stop() Stops the system from creating new particles, but does not destroy existing particles, it lets them finish out their lifetime.
If you watch the isPlaying variable you’ll see that after calling Stop() it continues to be isPlaying==true until the last particle finishes it’s lifetime and disappears, then it flips to isPlaying == false;

enableEmission = false stop the system from emitting new particles, but the system is still technically playing. isPlaying will never go to false. Why would you want to do this, rather then using Stop? I don’t know, but it’s likely useful for something…

Here’s a little test I did, I already had a handle on the ‘ball’ game object, so I just added a particle system and this code so I could play around. I couldn’t reproduce your issue, but perhaps using this will help you get a better understanding of the system and see whats going on?

void Update () {
	if (Input.GetKeyDown("g")) {
		ball.GetComponent<ParticleSystem>().enableEmission = true;
	}
	if (Input.GetKeyDown("h")) {
		ball.GetComponent<ParticleSystem>().enableEmission = false;
	}
	if (Input.GetKeyDown("j")) {
		ball.GetComponent<ParticleSystem>().Play();
	}
	if (Input.GetKeyDown("k")) {
		ball.GetComponent<ParticleSystem>().Stop();
	}
	Debug.Log ("Playing : " + ball.GetComponent<ParticleSystem>().isPlaying);
	Debug.Log ("Enabled : " + ball.GetComponent<ParticleSystem>().enableEmission);
	Debug.Log ("-------------------------------------------------------");

Maybe Stop() was a decapitated function, just use enableEmmision instead.