获得Animator当前播放的AnimationClip

AnimatorClipInfo
Description
Information about clip being played and blended by the Animator.
获得Animator的当前AnimationClip和混合动画的信息

Variables

clip Returns the animation clip played by the Animator.返回当前播放的AnimationClip
weight Returns the blending weight used by the Animator to blend this clip.返回该AnimationClip在播放中所有AnimationClip的权重

Animator

GetCurrentAnimationClipState Gets the list of AnimationInfo currently played by the current state.获取当前状态播放的当前动画信息列表。
GetCurrentAnimatorStateInfo Gets the current State information on a specified AnimatorController layer.获取指定的AnimatorController层的当前状态信息。



        Animator anim = new Animator();//获得Animator
        AnimatorClipInfo[] animatorClipInfo = anim.GetCurrentAnimatorClipInfo(0);//获得播放列表
        AnimatorStateInfo animatorStateInfo = anim.GetCurrentAnimatorStateInfo(0);
        foreach (AnimatorClipInfo a in animatorClipInfo) {
            AnimationClip an = a.clip;
        }

   
   
     
     
     
     
第三种方法
  AnimationClip clip = NpcAnimator.runtimeAnimatorController.animationClips[0];
        Debug.Log("animationClips[0]" + clip.name);


你可能感兴趣的:(unity,unity,AnimationClip,Animator)