Hi again…
I’m kinda stuck on how to use the WaitForSeconds. The idea here is I want to make sure that the animation plays out before making the object inactive. My script looks like this:
var dataflows : GameObject;
var topdoor: GameObject;
var boxbottom: GameObject;
var boxanimation: GameObject;
function Update () {
if (Input.GetKeyDown ("m")) {
boxanimation.animation.CrossFade("Close");
yield WaitForSeconds (2);
topdoor.active = false;
boxbottom.active = false;
dataflows.SetActiveRecursively(true);
}
if (Input.GetKeyDown ("n")) {
topdoor.active = true;
boxbottom.active = false;
boxanimation.animation.CrossFade("Open");
dataflows.SetActiveRecursively(false);
}
}
But no go. (Update() can not be coroutine.). Where am I wrong on that?