Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    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.