Hi guys, I’m Italian then I apologize for some grammatical errors…
I’ve this script:
#pragma strict
var muzzleFlash : Renderer;
var muzzleLight : Light;
function Start () {
muzzleFlash.enabled = false;
muzzleLight.enabled = false;
}
function Update () {
if(Input.GetButtonDown("Fire1")){
Shoot();
}
}
function Shoot(){
muzzleFlash.renderer.enabled=true;
muzzleLight.enabled = true;
yield WaitForSeconds(0.02);
muzzleFlash.renderer.enabled = false;
muzzleLight.enabled = false;
}
I want the MuzzleFlash turns on and off when I hold down “Fire1”…