Animation animation = GetComponent<Animation>();
animation.wrapMode = WrapMode.Loop;
AnimationEvent ev = new AnimationEvent();
ev.time = time;
ev.functionName = "excute";
animation.GetClip(Clip.name).AddEvent(ev);
animation.Play(Clip.name);
its not working in 5.5.0f3 at runtime but its working in 5.4.0?
what`s the problem?
please log a bug, it should work.
thanks for reply
I checked,its add successful at runtime, but its never be called, if I add a event in editor and I run the game,then I add another event at runtime, both events are working fine!
Andy what does the inspector say when you click on the Event on runtime? it should show a dropdown box with the added event
so the bug was fixed in 5.6
case 858511: Fixed an issue where Runtime Animation Events added to a Legacy clip wouldn’t be played