Execute seperate function after doing an animation..

Hi, im using Ani.mate to script my animations. The thing is while working in an "Update, FixedUpdate or LateUpdate"-function, there is no chance to execute "yield"-instructions. Therefore im using Ani.mate to tween my proberties.

Im coming from flash-programming and in the most available tweening-engines there is the feature to call seperate functions after a specfic animation is executed with an "onComplete"-proberty. As i know, Ani.mate doesnt support that feature, doesnt it? Does somebody know what i could do instead? Would be great to know. Thanks a lot.

Having skimmed the Ani.Mate docs, it seems that while you can't add callbacks directly to Ani.Mate calls, however the "From", "To", and "By" functions all return a WaitForSeconds object which can be conveniently used by a yield statement in a simple coroutine of your own. So, to get a callback after an animation has completed, you need to put both the Ani.Mate call and the callback call into a coroutine.

It would look something like this: (I say 'something' because I don't have time to test it!)

In Javascript:

function AnimateAndCallback() {
    yield Ani.Mate.By(transform, 5, {"position": new Vector3(0,20,0)});
    MyCallbackFunction();
}

// then call it using:
AnimateAndCallback();

And in C#:

IEnumerator AnimateAndCallback()
{
    yield return Ani.Mate.By(transform, 5, {"position": new Vector3(0,20,0)});
    MyCallbackFunction();
}

// then call it using:
StartCoroutine(AnimateAndCallback());

I'd suggest not using Update for things like this at all. In routines where I want to script a series of events, I typically use Start as a coroutine and yield everything in a loop. Some example pseudocode:

function Start () {
    while (true) {
    	while (no input) yield;
    	yield AnimationRoutine();
    	DoSomeFunction();
    }
}