Set the current time / frame of a Mecanim animation

Using the old system this is easy to do:

animation["Walk"].normalizedTime = 0.5F;

Gives us the middle point of the animation. Is this possible using Mecanim?

dunno, but now you can do just:

Animator.Play(state, layer, normalizedTime);

if you use

Animator.Play("same state you are", -1, 0f);

it will restart current state, if you put whatever float from 0 to 1 into normalized time, you can set it to any time position you want

you can also use

Animator.CrossFade(state, crossFadeTime, layer, normalizedTime);

As I stumbled across this issue as well, here is my simple solution now that ForceStateNormalizedTime is deprecated (Unity 5)

animatorcomponent.Play("yourste", -1, 0.5f);
animatorcomponent.speed = 0;

If you do not set the speed to 0 the animation will simply play from the new initial frame until the end.

In mecanim you can set the normalized where to start the animation in the transition.

To start a walk cycle with the other foot (left instead of right) you could create a boolean parameter named RightFootFirst. Then in the transition from idle to walk check if the RightFootFirst is true also. Create an other transition which is identical except thet now it RightFootFirst needs to be false and then set the offset of the walk state to 50%.

you can use the new Mecanim system in unity 4 which also supports the nomalised time function, for example

function Update (){


   if(basecurrentstate.IsName("Base Layer.AIM")){


but remember it works for the Base Layer only. Hope it helped, Good Luck :slight_smile:

If you have a longer animation, you can see the current playing state completely ignores the deprecated ForceStateNormalizedTime.