Is DOPath limited to transforms?
« on: June 04, 2016, 03:42:43 PM »
Hey there!

I am pretty new to DOTween (and also not really an experienced programmer), so I'm not sure whether this is a stupid question or not. Is there a way to use that DOPath tween on something else that the built-in transform component? I need to move a Vector3 position along a path, but it's part of another kind of component.

Thank you for your time!  :)

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Is DOPath limited to transforms?
« Reply #1 on: June 05, 2016, 11:51:52 AM »
Hello!

Just replied via mail, but I'm gonna copy-paste here too...

Not a stupid question at all :) But yes, while almost every other tween has a generic way that allows to tween every member, regardless of known Unity types like transforms, DOPath does require a transform component (because it can change extra stuff other than a Vector3 position). To do what you want, you could create an empty gameObject and DOPath that, while using an OnUpdate callback to grab its values every frame and assign them to the other component.

By the way, are you sure the other kind of Component doesn't have a Transform? In Unity, every Component has it.

Cheers,
Daniele