Get the current playback time of an animation in Mecanim

Hi,

I’m trying to get the current playback time of a playing animation as a float between 0 and 1 via script. In the legacy animation system, it was a simple enough matter (AnimationState.time). How would I go about it using Mecanim?

Cheers,

Ronan

Never mind. Worked it out.

AnimatorStateInfo currentState = animator.GetCurrentAnimatorStateInfo(animationLayer);

float playbackTime = currentState.normalizedTime % 1;