Transform position over X amount of time , how ?? c#

so i have my character move in a straight line but i want him to stop after 4 seconds . i have failed at trying to do this ( -)

transform.position += transform.forward * 5.0f * Time.deltaTime;

Have you seen iTween yet? It’s on the Asset Store, it’s free, and it’s simple to use. Your code would look like this (you just have to give it a position):

iTween.MoveTo(gameObject, myPosition, 4.0);

Although, in your case, iTween.MoveBy might be more useful.

If you insist on changing the transform.position yourself, one way to do that would be to add a Vector3.Lerp.

google transform.Translate or Vector3.Lerp

it will help

Dj