Stop immediately a ParticleSystem

Hi, I have a ParticleSystem with a start lifetime of 8 seconds and I need to stop it immediately without to finish its lifetime. Now I’m using ParticleSystem.Play(); and ParticleSystem.Stop(); but in this way the particle stops after the start lifetime is passed. I’ve tried .Pause() but it only pauses the emission and the ParticleSystem remains visible…

From the API of ParticleSystem.Stop:
ps.Stop(includeChildren, ParticleSystemStopBehavior.StopEmittingAndClear);

Hi @areFranz, I have included some scripts and explanations that may help.

Is this what you are looking for? (option 1)

alt text

You can call this script to enable or disable any gameobject.

Assign your gameobject in the inspector.

Let me know if this isn’t what you want.


Here’s the other option…

To deactivate the particles on a timer using the following script provided in Unity!

The script should be called ‘TimedObjectActivator’ and CAN be used to dissable a gameobject after a set amount of time. (script included below if you don’t have it pre-installed.)

What you need to do:

1. Add an entry (after attaching this script to a gameobject) in the inspector.

2. Set ‘Activate’ to ‘Deactivate’.

3. Drag the gameobject into the area which says ‘None (gameobject)’.

4. Set ‘0’ to ‘8’. (works in seconds)

You’re all done!

The script: (included in Unity 5 builds, c#)

Please contact me if you have any issues!

To stop immediatly the particles, use it :

gameObjectName.GetComponent<ParticleSystem>().Stop();
gameObjectName.GetComponent<ParticleSystem>().Clear();

The “Stop” function need the “Clear” function to stop immediatly the particles!