您的位置:首页 > 移动开发 > Unity3D

获得Animator当前播放的AnimationClip

2017-06-08 20:50 316 查看
AnimatorClipInfoDescriptionInformation 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;
}
[/code]
第三种方法  AnimationClip clip = NpcAnimator.runtimeAnimatorController.animationClips[0];        Debug.Log("animationClips[0]" + clip.name);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息