Unity 动画系统 AnimationEvent 动画事件

时间:2018-11-19 22:55:58   收藏:0   阅读:885

AnimationEvent类

技术分享图片

添加事件的方法:

1.创建一个动画事件 

AnimationEvent evt = new AnimationEvent();

evt.functionName = "PrintEvent";

evt.intParameter = 12345;

evt.time = 1.3f;

2.具体的事件函数,自己写的函数

public void PrintEvent(int i)

 {

  print("PrintEvent: " + i ); //自定义

 }

3.具体绑定,一般绑在AnimationClip上

Animator anim;

AnimationClip clip;

anim = GetComponent<Animator>();

clip = anim.runtimeAnimatorController.animationClips[0];

clip.AddEvent(evt);

原文:https://www.cnblogs.com/01zxs/p/9986326.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!