获得Animator当前播放的AnimationClip

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

Variables

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

Animator

GetCurrentAnimationClipStateGets the list of AnimationInfo currently played by the current state.获取当前状态播放的当前动画信息列表。
GetCurrentAnimatorStateInfoGets 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);


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值