unity on animation end 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 call function on animation end
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
GameObject self = animator.gameObject;
MyScript script = self.GetComponent<MyScript>();
Debug.Log("Animation has finished!");
script.SendMessage("MyFunction");
}