using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class EnemyAI : MonoBehaviour { [SerializeField] Transform target; NavMeshAgent navMeshAgent; // Start is called before the first frame update void Start() { navMeshAgent = GetComponent(); } // Update is called once per frame void Update() { navMeshAgent.SetDestination(target.position); } }