How to play particle system only one time ?

Hi there, I’m trying to play a particle system only ONE time, so here is my code:

public ParticleEmitter fireWork;
void Update() {
    // my stuffs
    if (distance < 0.3f) {
         // my other stuffs
         Instantiate(fireWork, particlePosition, Quaternion.identity);
         fireWork.Emit();
    }
}

But it not works, the particle’s still repeat times to times. Can anyone help me ?

http://docs.unity3d.com/ScriptReference/ParticleEmitter.Emit.html

Makes the emitter spit out a random
number of particles, as set by the
minEmission and maxEmission
properties.

So every time Update is called, and distance is < 0.3f you’ll get N particles emitted where minEmission < N < maxEmission

Don’t know if I can answer here and now, but after Instatiating your gameobject you have to destroy it, especially for particles.

So just do Destroy(ParticleGameobject, n) with n is the duration you want for the Particle.