Making a cloned particle emitter fire once only

Alright, well, I have this particle emitter prefab seperate from the gun enitity,

var Poof : Transform;

function OnCollisionEnter( ){

var clone : Transform;
clone = Instantiate(Poof, transform.position, transform.rotation);
 Destroy(clone, 0.5) ;

}

However I want the cloned prefab to disappear after a set amount of time.

For now, it just continually repeats.

The script clones the prefab and I want the cloned prefab particle emitter to be destroyed after it runs it's 1 second course.

On the particle prefab, their is a thing called Autodestruct, which'll make it destroy itself once it does the full animation.And then put on One Shot, and it'll do it right.

Alternatively, you could do the yield WaitForSeconds (Check API).

Hope this helps! Any questions, ask =).

Instantiating one-shot particle emitters that self-destruct is generally a bad idea, because its going to result in a lot of unnecessary drawcalls.

It's better to make your particle system a one-shot system that is set to not emit at all by default (or by setting .emit to false in Start()) and hiding it somewhere in the scene, and then positioning and rotating the emitter at the point of impact you want the effect to be, then calling the particleEmitter.Emit() function (which will make it emit once).