Hello.

Sometimes i need to create multiple chained sequences of movements with multiple DOTweenAnimation components. I'd like to be able to organize them using different GameObjects, so they are not all on a single GameObject, which makes it very hard to figure out what comes after what. For this to work, i would need a way to target a transform which is not the one the DOTweenAnimation component is part of.

I guess this is a feature request! :)

Thanks!
Jos

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Target a different transform with DotweenAnimation component
« Reply #1 on: July 04, 2015, 04:16:30 PM »
Hi again Jos!

I'm afraid that would be rather complicated. I had built something like that for HOTween, but having both a target-less Sequencer and a DOTweenAnimation engine on the same project would require a lot of work. I'm adding it to my todo list though, but on the "maybe" section :)

In the meantime, you can use a trick. You know that, if you use DOTween via script, you have Sequences, which do exactly what you mean to (and please mind, the tweens added to a Sequence don't need to be in a sequence: they can overlap each other—I know, bad naming choice)? So you could either script those animations or, if you want to use the visual DOTweenAnimation editor, do something like this:
  • Create all DOTweenAnimations as usual, but uncheck autoPlay (otherwise you won't be able to add them to a Sequence)
  • Create a script which accepts a public array of DOTweenAnimations, and drag all gameObjects with DOTweenAnimations there
  • Via script, get all the tweens created by those DOTweenAnimations (using myDOTweenAnimation.GetTweens(), which returns an array of all DOTweenAnimations on a single gameObject)
  • Now you can append those tweens to a Sequence and control them as a single tween