Dotween: How to wait for OnComplete of a few tweeners?

Created on 5 Jul 2017  路  5Comments  路  Source: Demigiant/dotween

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?

question

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.

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrtenda picture mrtenda  路  4Comments

ShadowTM picture ShadowTM  路  4Comments

RDeluxe picture RDeluxe  路  8Comments

Wolar picture Wolar  路  5Comments

Puutalo picture Puutalo  路  8Comments