flame particle system

how to i link the command if(Input.GetButton) with my particle system so that when i am pressing fire flames will appear but when im not holding fire the flames will disappear

thanks in advance

It should be as simple as this:

function Update() {

    if (Input.GetButton("Fire1")) {
        particleEmitter.emit = true;
    } else {
        particleEmitter.emit = false;

(placed on the particle system gameobject)

Would GUI.RepeatButton work? The documentation says "Make a button that is active as long as the user holds it down. " It appears to work more like the user is pressing the button over and over again until it's released then holding it down.

RepeatButton Doc