Demigiant Forum

Unity Assets => DOTween & DOTween Pro => Topic started by: BitBash on August 15, 2015, 04:58:25 PM

Title: DoTween on a Vector3
Post by: BitBash on August 15, 2015, 04:58:25 PM
Hi,

Quick question please. Looking through the documentation, I have not seen a method to Tween my own variable. For example:

public Vector3 customVector;

Is there something I am missing? Sorry if it's a stupid question, I really have looked.

Thanks!
Title: Re: DoTween on a Vector3
Post by: Daniele on August 15, 2015, 06:34:48 PM
Hi,

All DOTween shortcuts are made for known Unity variables, but they all take advantage of the generic tweening (http://dotween.demigiant.com/documentation.php#genericTo) way in the background. Said generic tweening way is what you want to use when tweening custom variables. In your case, here's an example:
Code: [Select]
// Tween customVector to 3,4,2 in 2 seconds
DOTween.To(()=> customVector, x=> customVector = x, new Vector3(3,4,2), 2);

Cheers,
Daniele
Title: Re: DoTween on a Vector3
Post by: BitBash on August 15, 2015, 07:57:52 PM
Amazing! Thanks Daniele.
Title: Re: DoTween on a Vector3
Post by: Daniele on August 15, 2015, 08:00:00 PM
You're welcome :)