How do I disable a particleSystem?

this is obsolete

GetComponent<ParticleSystem>().enableEmission = false;

this doesn’t work because the emission property is read only

GetComponent<ParticleSystem>().emission= false;

and this

ParticleSystem.EmissionModule em = GetComponent <ParticleSystem> ().emission; 
em.enabled = false;

doesn’t work because

NullReferenceException: Do not create your own module instances, get them from a ParticleSystem instance
UnityEngine.ParticleSystem+EmissionModule.set_enabled (System.Boolean value) (at <7e14932cc66145488a9440fe43b03616>:0)

3 Answers

3

try .Stop() but I am not sure. Because as I remember you playing it with .Play() so to stop them should be the .Stop() Sorry if not. I am beginner :slight_smile:

The unity API will usually have an answer for questions like these: Unity - Scripting API: ParticleSystem
_
You can stop the particle system by using the Stop() function as above. Or you can pause it with Pause() Or you can destroy the gameobject if it’s never going to be played again with Destroy(gameObject);

delete it or just set the emission to 0 with no bursts at all