the length of another objects animation.

I’m trying to access another object though varibiles.

      yield WaitForSeconds (Box, animation.clip.length);

Box is another GO assigned via inspector. Im trying to wait for the length of the Box’es"close" animation. The whole function goes like this:

var hingeOpen:AudioSource; 
var hingeClose:AudioSource; 
var Box: GameObject;
var PickupGraphic: GameObject;
var EmptyBox: GameObject;
function OnTriggerExit(other : Collider) { 
   if (other.tag == "Player") { 
      Debug.Log("Close"); 
      Box.animation.Play("close"); 
      hingeClose.Play(); 
      yield WaitForSeconds (Box, animation.clip.length);
//that was the buggy line
      Destroy(transform.root);
      Instantiate (EmptyBox, transform.position, transform.rotation);
      
   } 
}

I should be specifically addressing the Boxes’ “close” animation, though Im not too sure about how to type it all up…Any suggestions?
Thanks very much
AC

Use Box.animation[“close”].length

Hey Talzor, I forgot to say thank you…

Thhhaaannkkk yyooouuu!!!

This is handy indeeeed…!
AC