Please make normalizedTime normal...

After scouring the internet, normalizedTime seems to be quite an issue…

Here’s my scenario, I have a melee combat script that runs certain things based on normalizedTime between 0 and 1 right, I understand that above 1 means that’s it’s loop count and that’s not a massive issue, a bit abnormal but not an issue.

My issue is I’m triggering an animation from my Idle animation, the transition has no exit time and plays instantly as expected, the normalized time I’m receiving is some completely arbitrary number I’m guessing is based off my Idle animation, I could be half way through my swing animation and still receiving values like 4.3 etc etc… sometimes I receive the correct normalizedTime, like 1 out of 10 times.

Why can’t I play a non-looping animation that instantly triggers and receive the correct normalizedTime between 0 and 1. It almost never works as expected and I’m not alone with this issue.

Can we please have a normalizedTime with no fancy bits that works the way we would expect something called ‘normalizedTime’ to work? Re-name the current one to wibblyWobblyTime or something.

Thanks.

Which function did you call to get your normalized time? I suspect you are getting only the idle state’s normalized time; in an animation transition, you will want to use GetNextAnimatorStateInfo() to receive next state’s normalized time.

When are you reading off the normalized time?

If it’s on the same frame as you’re triggering the animation, it makes sense that you’re getting the time of your idle animation. This is because evaluation of the state machine happens after Update has happened. See here.

You should be getting the correct normalized time in LateUpdate. If you’re reading off the state of the animation, that’s the correct way to do it anyway, as it’s after the animation has resolved.