Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: focus on June 07, 2015, 05:05:22 PM
-
Hey, Daniele!
Is it possible to determine if some DOTweenAnimation instance was played to the end without using OnComplete?
I have bunch of objects with DOTweenAnimation on them. And they have AutoPlay enabled & AutoKill disabled.
The goal - make DOTweenAnimation play on every object (re-)activation.
It works for the first time (when object if activated first time), but when I de-activate and re-activate it back I'd like to play animation again (rewind and play). I guess I should do it in the OnEnable MonoBehaviour callback and looks like I'm missing some obvious option as always, but I can't figure out how to check if DOTweenAnimation was played to the end to rewind it and re-play only when it was fully played, but not in the first time %)
I hope I didn't confused you even more with such fuzzy description =D
Cheers!
-
I am super-confused indeed :D
If you want to see if all the DOTweenAnimations of a gameObject have played, you could first get the tweens (if you call GetTweens() from any of the DOTweenAnimations, you will get a List<Tween> of all the DOTweenAnimations on the same gameObject), then check if all of them return TRUE with IsComplete (http://dotween.demigiant.com/documentation.php?api=IsComplete).
To know how many times have played though, you will need a custom check for the first activation, since there's no existing tween method/property otherwise.
Did I get it right? Did I? :D
-
Awesome, GetTweens() looks like a right thing I was looked for, thanks! =)
Did I get it right? Did I? :D
Bingo! =D
-
Wohooo :)