when i try to dynamically add an AnimationEvent to the end of a AnimationClip, everything works fine in the editor. on the iphone (3gs + 4) everything went fine as long as the rest of the scene was empty, but the more objects i added/more rendering needed, the event started to drop/not been called more and more and with the full scene, it nearly never got called.
i did a dirty workaround now, but still wondering if AnimationEvents under stress will not get called reliably. or did i just make a stupid mistake, as i'm new to unity?
thanks a lot for any hints!
here's the (simplified) code not working properly:
AnimationClip actionClip;
void Start()
{
AnimationClip actionClip = animation.GetClip ("action");
AnimationEvent AniEndEvent = new AnimationEvent ();
AniEndEvent.functionName = "OnActionEnded";
AniEndEvent.time = actionClip.length;
runClip.AddEvent (AniEndEvent);
animation.Play(actionClip.name);
}
private void OnActionEnded()
{
Debug.Log("action ended");
}