1

I'm using Unity 5.3x for a game. I've a Prefab with the following structure hirerchy of object

MyPrefab -> MyContainer -> NitroEffect -> NitroFlamethrowerFire

I'm having problem on how to Play Stop Particle System. I'm using the following code, but (don't laugh) sometimes works, sometimes not, and i don't know why.

Container = transform.Find ("MyContainer").gameObject;

PS_Nitro = Container .transform.FindChild("NitroEffect/NitroFlamethrowerFire").GetComponent(); PS_Nitro.enableEmission = false; //to stop emission
And

PS_Nitro.enableEmission = true; // to start emission

So my question is: how to start stop properly a Particle emission ?

stighy
  • 7,260
  • 25
  • 97
  • 157

1 Answers1

4

That's the way - enableEmission property.

All you need is just to save the link to the particle system and not search for it each time you have to start/stop it.

Just save your reference for PS_Nitro to some variable and use it later on.

AgentFire
  • 8,944
  • 8
  • 43
  • 90