Unity3D动画回调的问题
我看了网上的资料(参http://bbs.csdn.net/topics/390897449帖子16楼),都是这么设置的:
using UnityEngine;
using System.Collections;
public class Try : MonoBehaviour {
void Start () {
Animation animation = gameObject.GetComponent<Animation>();
AnimationEvent evt = new AnimationEvent();
evt.time = animation.GetClip("ani").length;
evt.functionName = "Test";
animation.GetClip("ani").AddEvent(evt);
Debug.Log(act.Att.gameObject.name);
}
public void Test() {
Debug.Log("Test has been done");
}
}
为什么我这么设置后,动画运行到对应时间报这个错:
"gameObject" animationevent "Test" has no receiver!Are you missing a component?