DOTween Path - Dynamically Change Values
« on: October 12, 2015, 11:01:57 AM »

This is my first time using DOTween, I'm currently using the Path Tween to move a space rocket around on loop. That's all set up correctly and is working fine. However, I want to be able to adjust the speed of the rocket (duration) dynamically via JS.

I've taken a look at the documentation for this, and honestly, I don't understand it? It seems far to complicated to do something fairly simple. I thought I could just do this:

dotweenObject.GetComponent.<DOTweenPath>.().TweenOptions.Duration = ##

Please advise, thanks.



  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: DOTween Path - Dynamically Change Values
« Reply #1 on: October 15, 2015, 02:38:38 PM »

The duration of a tween can't be changed directly, but if you get a reference to it you can change its TimeScale. To do it:
Code: [Select]
// Get the tween reference from the path
Tween t = dotweenObject.GetComponent<DOTweenPath>().GetTween();
// Change the timeScale to 2x
t.timeScale = 2;