Question by
Nianderfall · Jul 28, 2017 at 04:11 PM ·
collisionontriggerentertag
How to check for a player tag OnTriggerEnter
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;
}
Comment
Answer by Nianderfall · Jul 28, 2017 at 04:36 PM
I have just figured it out
Congratulations that you find it out and another congratulation for making this thread useless trash dumping around