Particle system not working.

I’m trying to make a particle system for when a gun fires heres what I got -

<code>var destroyOnTime : float;

private var falseemit : float;
var particleEmitterObject : GameObject;

function Update () {
falseemit+= Time.deltaTime;
if(falseemit >= destroyOnTime){
particleEmitterObject.particleEmitter.emit = false;
}

if (Input.GetButtonDown("Fire1")) {

particleEmitterObject.particleEmitter.emit = true; }
}

but when I debug it the emitter starts by emitting it at the time that I set but after that I wont emit anything anymore what am I doing wrong?

According to this code, once you pass the value set in “destroyOnTime”, you make sure the emitter is disabled in the Update function().

Also, it seems you wish to emit by clicking the button and not by a timer.

The timer here is used to disable the emitter.

If you want the emitter to be disabled automatically “destroyOnTime” seconds after you’ve clicked it you can do do this:

if (Input.GetButtonDown("Fire1")) 
{
  falseemit = 0; // Reset your timing
  articleEmitterObject.particleEmitter.emit = true; 
}