using System.Collections; using System.Collections.Generic; using UnityEngine; public class move : MonoBehaviour { public Vector3 MoveTo= new Vector3(14,0,0); long timea; // Start is called before the first frame update void Start() { timea = System.DateTime.Now.Ticks; Debug.Log(timea); } public void Update() { transform.position = Vector3.Lerp(transform.position, MoveTo, 0.001f); long duration = (System.DateTime.Now.Ticks - timea) / 10000000; Debug.Log("duration=" + duration); if(duration > 4) { Destroy(gameObject); } } }