*

focus

  • ***
  • 26
    • View Profile
    • blog
DOTweenAnimation question
« 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!

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: DOTweenAnimation question
« Reply #1 on: June 08, 2015, 01:24:44 AM »
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.

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

*

focus

  • ***
  • 26
    • View Profile
    • blog
Re: DOTweenAnimation question
« Reply #2 on: June 08, 2015, 01:42:11 PM »
Awesome, GetTweens() looks like a right thing I was looked for, thanks! =)

Did I get it right? Did I? :D

Bingo! =D

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: DOTweenAnimation question
« Reply #3 on: June 08, 2015, 01:50:51 PM »
Wohooo :)