- Home /
Enable/Disable of Particles through script
I'm pretty sure that this is the what I'm trying to do is bead easy, but I can for my life figure it out. I'm trying to to make a trigger that when the player enters will enable a flame particle to appear. Now I don't know much about scripting, to be honest I'm really weak at scripting, but I'm sure that getting a particle (and or game-object) to appear when the player enters a trigger isn't hard at all. SO any help anyone can give would be great. Thanks.
Additionally I'm using Unity Script.
Answer by chelnok · Nov 19, 2012 at 01:38 PM
If you are have Particle System component in your gameobject, you can use Play(), Stop(), Pause().
This is what you need in your js-file:
function OnTriggerEnter (other : Collider) {
transform.particleSystem.Play();
}
function OnTriggerExit (other : Collider) {
transform.particleSystem.Stop();
}
thanks, fixed. ..actually it wasnt parenthesis, but semicolon two times like this: ;; But that was what you meant, right :)