using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class enemy : MonoBehaviour { public NavMeshAgent _agent; public float bloodvolume; public Transform player; // Start is called before the first frame update void Start() { _agent = GetComponent(); player=GameObject.FindWithTag("Player").transform; } // Update is called once per frame void Update() { setMoveTo(player); } public void setMoveTo(Transform target) { _agent.SetDestination(target.position); } }