using UnityEngine; using UnityEngine.AI; public class EnemyMove : MonoBehaviour { public GameObject player; private NavMeshAgent _meshAgent; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { _meshAgent = GetComponent(); } // Update is called once per frame void Update() { Vector3 playerPos = player.transform.position; _meshAgent.SetDestination(playerPos); } }