- Home /
Question by
paco morales · Jan 13, 2011 at 09:25 PM ·
keyboardparticlehit
How I can activate or deactivate a Particle with my keyboard?
Hello
I want to Activate or deactivate a Particle (Sparkle Particles) by hitting one keyboard, Is there any script for that?
Thanks in advance!
Comment
Answer by DaveA · Jan 13, 2011 at 09:56 PM
Attach to your PE game object to toggle with the 'a' key (not tested):
private var pe : ParticleEmitter;
function Start() { pe = GetComponent(ParticleEmitter); }
function Update() { if (Input.GetKeyDown("a")) pe.emit = !pe.emit; }
O$$anonymous$$, I made the empty game object then I attached the particle system and I created the script with your data, but don't work :(
Answer by mrde · Jan 13, 2011 at 09:48 PM
no, but you can write code for this GameObject for disable particle component (or particle.emit = !particle.emit)