Turning the Particle System on and off

I would like to be able to turn off a Particle System when a user is not using thrust. I am using the Particle System's GameObject.active to do this. It works but when I set it to true again, particles will appear at the location where it was set to False (until their lifespan ends).

Is there a better way to enable/disable a Particle System?

Use GameObject.particleEmitter.emit = true;

EDIT By Meltdown :

The above line of code is only applicable to the legacy particle system, and should no longer be used.

The correct way to turn a particle system on and off is the following…

ParticleSystem.Play() - Start emitting from the particle system

ParticleSystem.Stop() - Stop emitting from the particle system

Note : You should not make a particle system active or inactive using SetActive(bool), as essentially any existing particles will just dissapear or re-appear, which looks unnatural. Using Play() or Stop() as above, will stop emitting, but keep showing any particles that are still within their life span.

Sorry for the necro on this thread. However when you google “disable particle system unity” this page is top so I am assuming it is a very looked at page.

Anyways, with Unity5 the documentation has changed a little bit for those using the .GetComponent() function of the GameObject class in c#.

Use this instead:

gameObject.GetComponent<ParticleSystem>().enableEmission = false;

Again, sorry for the necro but I hope this helps some people!

Cheers,
Swirllyman

The correct way to turn a particle system on and off is the following…

ParticleSystem.Play() - Start emitting from the particle system

ParticleSystem.Stop() - Stop emitting from the particle system

Note : You should not make a particle system active or inactive, as essentially any existing particles will just dissapear or re-appear, which looks unnatural.

None of the things listed here worked for me, so I played around a bit and got this:

Call ParticleSystem.Play() to play it

Call ParticleSystem.Pause() to pause it.
NOTE: The Pause() method stops all particles, and they just end up freezing where they were. If you wanted them to go away completely, also call ParticleSystem.Clear()

In case anyone is still looking for this, particle.enableEmission is now deprecated, we need to use
varForParticles.emission.enabled = false;

[dupe] [delete]

I used this… (C Sharp):

ParticleSystem particle = (ParticleSystem)gameObject.GetComponent("ParticleSystem");
particle.enableEmission = false;