Any way to check if a animation is halfway done playing?

I know I can check if a animation is currently playing or not (or rather in a specific state) with:


But lets say I’ve confirmed I am in state ‘Attack’, aka, the Attack animation is playing. How do I specifically check if the animation has played 50% of the clip/frames?

// For non-looping clips
anim.GetCurrentAnimatorStateInfo(0).IsName(“Attack”).normalizedTime == 0.5f;
The normalized time is a value between 0 and 1, where 1 = 100% of the clip played. That being said, if you’re playing a looping animation, I believe that number can be higher than 1f, indicating the number of times it has been played. If you’re working with looping animations then the following is better.

// For looping clips
(anim.GetCurrentAnimatorStateInfo(0).IsName("Attack").normalizedTime % 1f) == 0.5f;