- Home /
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?
Answer by GuyTidhar · Jun 29, 2011 at 05:20 AM
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;
}
Your answer
Follow this Question
Related Questions
How can I make fatal particles? (C#) 1 Answer
How to Activate Particle System? 0 Answers
Matching collision normal for sub-emitter 0 Answers
No particle emitter in hieararchy, but particles still appearing?? 2 Answers
Make Mesh Particles go Outward 1 Answer