unity Animator获得当前动画最真实的时间

public void InitData(Animator ani)
{
    if (ani == null)
    {
        return;
    }
    m_animator = ani;
    m_animator.enabled = false;
    AnimationClip clip = m_animator.runtimeAnimatorController.animationClips[0];
    speed = m_animator.GetCurrentAnimatorStateInfo(0).speed;
    //通过测试得知,速度改变是成平方的关系,比如speed为2,则比原速度快4倍
    time = clip.length / (speed * speed);
    Debug.Log(time);
    AnimationManager.Instance.PlayPause(m_animator);
}

你可能感兴趣的:(unity Animator获得当前动画最真实的时间)