using UnityEngine;
public class Example : MonoBehaviour
{
public Vector3 fromPosition = Vector3.zero;
public Vector3 toPosition = Vector3.one;
public float speed = 1;
private float progress;
private void Update()
{
progress += Time.deltaTime*speed;
transform.position = Vector3.Lerp(fromPosition, toPosition, progress);
}
}
void Update(){
transform.Translate(Vector3.Forward*Speed*Time.deltaTime);}