- Home /
Question by
DiligentGear · May 14, 2014 at 12:52 AM ·
animationanimatormecanimanimator controller
How to get length of animation in Mecanim?
Note: I'm using Mecanim, so please don't copy and paste legacy codes.
I'd like to know a clean/correct way to get the length of animation in Mecanim.
The problem is that there is no approach to access a specific state in Animator Controller. The script interface only provides access to current state and next state.
Although this answer can get "state", it does not provide the length like AnimatorStateInfo does.
Is there any good way to this?
Comment
Answer by Felix_Draob · Apr 28, 2020 at 02:28 PM
float value = anim.GetCurrentAnimatorStateInfo(0).length;