I need to make a Gameobject unactive when the levels starts (Fire.Active = false) and then if i press a button,it will become Active for 0.2 seconds and then become Unactive again.
This is what I’ve got so far and It doesn’t works at all.
var Fire : GameObject;
var Fire_S : AudioClip;
function Start() {
if (Input.GetKeyDown (KeyCode.E)) {
Fire.active = true;
yield WaitForSeconds (0.2);
Fire.active = false;
audio.PlayOneShot(Fire_S, 1);
}
}
I know I’m doing something wrong,please help me :[