I suspect that either animation.IsPlaying(“Attack”) is returning false or animation[“Attack”].length is too large - also can you show how you’re calling/invoking this Test() method?
I would add some additional trace printing to see if where the error exists, like so:
IEnumerator Test()
{
//not printing
// Add
Debug.Log("attack is: " + animation.IsPlaying("Attack"));
while(animation.IsPlaying("Attack"))
{
// Add
Debug.Log("Waiting for: " + animation["Attack"].length);
yield return new WaitForSeconds(animation["Attack"].length);
Debug.Log("Done");
}
//working
Debug.Log("Hello");
yield return new WaitForSeconds(3);
Debug.Log("It's been 3 seconds");
}