How to retrieve the total duration time in seconds of an animation clip?

Given is the Animator object in the code : Animator animator = ... ;

Well probably some combination of this: Unity - Scripting API: Animator.GetCurrentAnimatorClipInfo to get the animation clips, then simply reading the length property of the clip: Unity - Scripting API: AnimationClip.length

1 Like

Thx, this helps me dude:

    void Start()
    {
        //Get them_Animator, which you attach to the GameObject you intend to animate.
        m_Animator = gameObject.GetComponent<Animator>();
        //Fetch the current Animation clip information for the base layer
        m_CurrentClipInfo = this.m_Animator.GetCurrentAnimatorClipInfo(0);
        //Access the current length of the clip
        m_CurrentClipLength = m_CurrentClipInfo[0].clip.length;
        //Access the Animation clip name
        m_ClipName = m_CurrentClipInfo[0].clip.name;
    }
1 Like

For this i get frames/framerate value. Also for .time definition!