- Home /
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 ?
Answer by flaviusxvii · Nov 21, 2014 at 03:30 AM
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
thanks for your help. But what I want is call the fully particles just 1 time. I've tried the $$anonymous$$, max emission but it isn't the solution in my situation, the particle system still called many times.
Answer by hyaenna · Dec 13, 2017 at 11:39 PM
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613172048im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Particle Playback Error in 5.4 0 Answers
Particle emitter to emit "one-shot" on specific occasions 5 Answers
Particle Emitter Toggle ON/OFF 1 Answer
Can you make a particle emitter that emits inwards? 4 Answers
Particle emitter object destroys itself 2 Answers