Fire doesn't turn on with script

function Update () { // if the key is held during this update, we "toggle" the enabled value if (Input.GetKeyDown(KeyCode.W)) { particleEmitter.emit = !particleEmitter.emit; } }

Above is the code to turn the particl eemitter on and off. I have W for moving forward, and so the desired effect is while moving, particle emit, while not, particle stop, but i've tried;

GetKey GetKeyDown GetKeyUp

and none produced the desired results, they all either skipped turning off, skipped turning on, or just turned off/on at different times.

I guess you want to make the emitter to fire particles as long as W is pressed, so try this:

function Update ()
{
   particleEmitter.emit = (Input.GetKeyDown(KeyCode.W));
}

function Update ()
{
   particleEmitter.emit = (Input.GetKey(KeyCode.W));
}

Thanks to oliver, this is the ammended, working script