untity how to know when an animation is done code example
Example 1: condition when a animation finishes in unity
if(anim.GetCurrentAnimatorStateInfo(0).normalizedTime > 1){
Debug.Log("not playing");
}
else{
Debug.Log("playing");
}
Example 2: unity animator check if animation is playing
bool isPlaying(Animator anim, string stateName)
{
if (anim.GetCurrentAnimatorStateInfo(animLayer).IsName(stateName) &&
anim.GetCurrentAnimatorStateInfo(animLayer).normalizedTime < 1.0f)
return true;
else
return false;
}