how to restart mecanim state animation or play it from random position [SOLVED]

we’ve been looking for the answer almost week and we found it and it’s pretty simple, so we decided to share for those who are looking too :smiley: there’s no need for tricks with empty or duplicate state …

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);

Beautiful. Thank you so much. The documentation @Box_Frog shared, Unity - Scripting API: Animator.Play, is also very clutch if you are interested in how or why this works.

Beautiful. Thank you so much. The documentation @Box_Frog shared, Unity - Scripting API: Animator.Play, is also very clutch if you are interested in how or why this works.