Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: par on December 15, 2015, 06:21:51 PM
-
How would I access the actual tween that is responsible for the callback?
public void someMethod(Transform transform) {
transform.DOScale(Vector3.zero, 1).OnComplete(doSomethingAfterTween);
}
public void doSomethingAfterTween() {
Tween theTween = ????
}
Thanks!
PAR
-
Hi Par!
You can't. But you could always store it as a reference and pass it to the callback as a lambda:
public void someMethod(Transform transform) {
Tween t = transform.DOScale(Vector3.zero, 1);
t.OnComplete(()=> doSomethingAfterTween(t));
}
public void doSomethingAfterTween(Tween t) {
Tween theTween = t;
}
-
Awesome, I actually like this more than a lot of other patterns used for this type of thing. Passing in the reference is way cleaner than searching in some monolithic static class.
Thanks!
PAR