Problem With Colliders and Checking Tags

I’m having a problem checking if the collider that is triggering the OnTriggerStay function is the Player, I’ve tried a few ways and nothing is working. I’ve tested it to the point where I know the problem is in the condition of the if statement. What am I doing wrong?

Update: Upon further testing, it seems that col.gameObject is referencing the VisionCollider, so I need to find out how to know if the Player object is what’s triggering it.

Some screenshots of setup and code:

3018534--225438--2.PNG 3018534--225439--3.PNG

Duh, I didn’t put the f-ing script on the VisionCollider.

1 Like

First of all, change all your Debug.Log(“Test”) calls to be each unique: Test1, Test2, etc. Otherwise you won’t know WTF is really happening.

You can also just do a Debug.Log( col.name) at the start of the OnTriggerStay() function so you can see what is hitting it and staying in it.