- Home /
Play particle effect upon animation trigger
So I have it set that space plays my character animation but how would I also make it play the particle effect for a short say 3 second burst at the same time?
What is this particle effect? You mean you want to make it so that space makes a particle emmiter you've set up emit particles for 3 seconds and then turn it off?
Yeah exactly, it's the flame particle standard asset. It is basically a short blast from my characters jetpack.
Answer by DaveA · Feb 22, 2011 at 10:40 PM
Put this on the object with the emitter (untested):
var emitTime = 3.0 private var lastSpaceTime = 0; private var pe : ParticleEmitter = null;
Start() { pe = GetComponent(ParticleEmitter); }
Update() { if (Input.GetKeyDown("space")) { pe.emit = true; lastSpaceTime = Time.time; }
if (pe.emit && (Time.time - lastSpaceTime) >= emitTime) { pe.emit = false; } }
Hmmm, I tried adding this as a Java script but get...
$$anonymous$$ identifier: 'Start'. (BCE0005)
$$anonymous$$ identifier: 'Update'. (BCE0005)
Your answer
Follow this Question
Related Questions
how to emitt a particle effect on touch 2 Answers
trigger animation problems 2 Answers
Drop down menu trigger'd cutscene 0 Answers
Light animation and Main Menu animation at same time from 1 trigger 0 Answers