Hide GameObject - Re-Apear after 5sec

Hi i have a problem, I tried every possible thing that i got in my head but i can’t make it done. the thing is that, I can’t disable object and enable object after 5sec. and theres this (read after code)

var Animator : GameObject;
var WpnHolder : GameObject;

private var gui1 : boolean;
private var doAnim : boolean;
///////////////////////////////
function Update()
{
	if(Input.GetKey(KeyCode.Space)&& doAnim)
	{
	Animator.animation.CrossFade("Climb");
	WpnHolder.active = false;
	yield WaitForSeconds (5)
	WpnHolder.active = true;
	}
}

Yes i know that it can not be corountine update() but
i tried this

var Animator : GameObject;
var WpnHolder : GameObject;

private var gui1 : boolean;
private var doAnim : boolean;
///////////////////////////////
function Update()
{
	if(Input.GetKey(KeyCode.Space)&& doAnim)
	{
	Animator.animation.CrossFade("Climb");
	WpnHolder.active = false;
	wait();
	WpnHolder.active = true;
	}
}
function wait()
{
   yield WaitForSeconds (5);
}

i can’t figure it out,help please :slight_smile:

I think you need to read up on what coroutines are and how to use them. I highly recommend this video. Then everything inside your if(Input.GetKey()) statement would go inside a coroutine and you’d call that when a key is pressed.