I'm running tweeners for a few objects and I need to wait for finish of those tweeners?
For one Tweener it's easy:
myTween.OnStart(myStartFunction).OnComplete(myCompleteFunction);
But I can't find a way how to do it for a few tweeners. Just to do a count variable? Or is there some supporting for it?
Hi,
You could place them all inside a Sequence, and use the Sequence's OnComplete.
Otherwise, you could use a routine to check if they're all complete or not, by going over them and checking myTween.IsComplete();
You could place them all inside a Sequence
Then tweeners will be played one after the other, rather than all at once. Or is there a way to play it at once?
I use RSG Promise.
var p1 = new Promise();
var p2 = new Promise();
tweener1.OnComplete( () => p1.Resolve() );
tweener2.OnComplete( () => p2.Resolve() );
Promise.All( p1, p2 ).Then( ... );
I'm trying to minimize it:
var p1 = new Promise( (resolve, reject) => tweener1.OnComplete( (TweenCallback) resolve ) );
But System.Action can't be cast to TweenCallback, What is sense is TweenCallback?
This way works:
var p1 = new Promise( (resolve, reject) => tweener1.OnComplete( () => resolve() ) );
You can insert tweens at any time position in a Sequence (using the Insert method), or just use Join instead of Append to have them automatically inserted at the same position.
Most helpful comment
You can insert tweens at any time position in a Sequence (using the Insert method), or just use Join instead of Append to have them automatically inserted at the same position.