How to activate a Particle System?
I recently picked Unity back up after about 1 1/2 years, and it seems the particle system has changed. I've looked very hard for the answer, but to no avail, I come here.
I am simply trying to activate, or "Play", a particle system after the press of a button.
I turned "Loop" off and disabled "Play on Awake".
I thought this would work:
GetComponent <ParticleSystem>().Play ();
but from what I've read, somehow using these pieces of code may also work:
ParticleSystem.EmissionModule em = GetComponent<ParticleSystem>().emission;
em.enabled = true;
Again, all I want to do is enable this particle system anytime I press a button.
Answer by chrisguy136 · Feb 25, 2016 at 09:13 PM
-.- I figured it out, you literally just have to put it in order:
GetComponent <ParticleSystem>().Play ();
ParticleSystem.EmissionModule em = GetComponent<ParticleSystem>().emission;
em.enabled = true;
this totally helped me! an old tutorial from 2019 gave me a script where my:
void OnEnable()
wouldn't even start! ... so I followed your code and activated AND enabled my particle effect! now it works! thank-you!
I guess activate=enable back in 2019 unity? lol
Your answer
Follow this Question
Related Questions
Particles emited from bellow the cone base shell 2 Answers
[SOLVED] Particle system runs in Edit Mode but not in Play Mode 0 Answers
Are there any disadvantages to using the legacy Ellipsoid Particle System in Unity 5 over Shuriken. 0 Answers
Particle System changing collider shape 0 Answers
Start collision detection of particles after certain time 0 Answers