Animate an object to a new position...

If I am currently using:

transform.localPosition.x = 4;

to instantly transport an object (regardless of where it is) to a new position, how would I make the object gradually move to its new destination?

You could lerp (Vector3.Lerp) between the two positions in a Coroutine.

There is also a popular Unity package called iTween, and it does the heavy lifting for you - all you need to do is learn the specific calls.

For example:


This code will move `gameObject` to `(4,0,0)` over 2 seconds.