Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mecanim: get animation duration from Animator state name

Discussion in 'Animation' started by K1kk0z90_Unity, Jul 21, 2018.

  1. K1kk0z90_Unity

    K1kk0z90_Unity

    Joined:
    Jun 2, 2013
    Posts:
    90
    Hi all,
    I have a base Animator Controller, with different Animator Override Controllers based on that. In C# scripting, I need to get at runtime the duration of the animation associated to a specific Mecanim state. In other words, I need to get the animation length by Mecanim state name (not animation clip name, which could differ in Override Controllers). How can I do it?

    Thank you in advance.