代码事件监听
using UnityEngine;
using System.Collections;
public class BoxEventScript : MonoBehaviour {
void Start () {
AnimationClip gunMove = animation.GetClip("left");//动画名
AnimationEvent aevent = new AnimationEvent();
aevent.functionName = "setInfo"; //方法名
aevent.time = 1.05f;
gunMove.AddEvent(aevent);
}
void Update () {
}
void setInfo()
{
Debug.Log("setInfo");
}
}
图形操作
添加 事件在对应的时间点(或双击)
选择脚本的方法