using System.Collections; using System.Collections.Generic; using UnityEngine; public class NPCMove : MonoBehaviour { public Vector3 start, end; public float speed = 2f; void Start() { start = this.transform.position; } // Update is called once per frame void Update() { transform.position = Vector3.MoveTowards(transform.position, end, Time.deltaTime * speed); if (Vector3.Distance(transform.position, end) <= 1f) { transform.position = start; } } }