获取Animator的总帧率 和 当前播放帧

        private float GetTotalFrame(Animator animator)
        {
            var clip = animator.GetCurrentAnimatorClipInfo(0)[0].clip;
            var length = clip.length;
            float frameRate = clip.frameRate;
            return length / (1 / frameRate);
        }
       public void Update(float deltaTime)
        {
            var currentTime = animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
            int currentFrame = (int)(Mathf.Floor(totalFrame * currentTime) % totalFrame);
        }

你可能感兴趣的:(获取Animator的总帧率 和 当前播放帧)