x


AnimationEvent not reliably triggerd on iPhone

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");
}
more ▼

asked Dec 01 '10 at 11:57 AM

nada gravatar image

nada
18 1 1 4

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

There used to be a bug which caused animation not to be sampled at last frame. It might be that the same problem causes the event not to be executed. I fixed the sampling bug, so it might be that the event bug is fixed too. I fixed a bunch of other event bugs too...

You can try setting wrapMode to ClampForever and see if that helps you.

more ▼

answered Dec 02 '10 at 06:17 PM

Paulius Liekis gravatar image

Paulius Liekis
7.3k 16 24 45

hey paulius. tnx for your answer. i will check this asap.

Dec 05 '10 at 04:52 PM nada

i finally tried with clampforever for the update and it did the trick. not heavily tested, but worked on all our intern devices. thanks for the hint!

Dec 17 '10 at 10:43 AM nada
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5078
x3786
x1999
x45

asked: Dec 01 '10 at 11:57 AM

Seen: 1297 times

Last Updated: Dec 01 '10 at 11:57 AM