I was wondering how to make it so that it will only set the bool to true if its a player. This is my code…
public NavMeshAgent agent;
Animator Anim;
private void Start()
{
Anim = GetComponent<Animator>();
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
Anim.SetBool("Attack1", true);
print("time");
}
}
private void OnTriggerExit(Collider other)
{
Anim.SetBool("Attack1", false);
}
void Update()
{
agent = GetComponent<NavMeshAgent>();
agent.destination = GameObject.Find("Player").transform.position;
}