- Home /
My particle emitter stops emitting once the W key is released but doesnt start when it is pressed again
Hi all, I am trying to get a particle emitter to fire repeatedly whenever W is pressed however once released after the first press the particle emitter refuses to fire again. Here is the code I am using (JS obviously):
function Update () {
if (Input.GetKey (KeyCode.W))
{
particleEmitter.emit = true;
}
if (!Input.GetKey (KeyCode.W))
{
particleEmitter.emit = false;
}
}
Please help!! Thanks
Answer by Bunny83 · Apr 05, 2011 at 01:38 PM
I guess you set Autodestruct to true at your ParticleAnimator, that will destroy the whole gameobject once the last particle have disappeared.
Thanks :) $$anonymous$$y problem occurred when particleemitters maxemission dropped below 4. I tried almost everything but this..
Answer by OoglyWoogly · Apr 05, 2011 at 03:18 PM
Thanks, that solved it.
Noobie error i'm afraid. :-)
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
How to loop a function? 2 Answers
How can i set my script on loop (JS) 1 Answer
Only 2 out of 4 Objects ever spawn... Why ?(Closed) 2 Answers
How do I reset a for loop variable??? 3 Answers