首页 > 编程语言 > 详细

Unity 动画系统 AnimationEvent 动画事件

时间:2018-11-19 22:55:58      阅读:885      评论:0      收藏:0      [点我收藏+]

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);

Unity 动画系统 AnimationEvent 动画事件

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!