I’m trying to use the AnimatorStateInfo.normalizedTime property to allow me to execute code when the time reaches a specific percentage of the animation time.
I’d much rather use specfic keyframes but there doesn’t seem to be a way to get what frame the animation is currently on…
The issue is that I have a non-looped animation, that is only playing once, and as soon as the animation starts, the normalized time is already over 1. According to documentation, it should only ever be between zero and never exceed 1 for non-looped animations.
So far everything is (more or less) working as expected, but the SendBallInMotion() function is called as soon as the animation starts, rather than at the end of the animation (because the normalizedtime is way over what it should be).
Is there a better way to do this sort of thing?
Below is a screen grab of the breakpoint at the entry to a switch. You can see, that the first time this code executes, the normalizedTime is already at 1.73 and the animation hasn’t even started yet.