Question by
SomeRandomUnityDev10 · Jul 12, 2021 at 12:18 PM ·
c#triggercollider2dtags
How to check if player collides with trigger?
Hi! I've looked across the internet, but no answer has worked! I'm trying to make an enemy script with a Field of View that is a circle in a 2D scroller game, and I need it to be a trigger that triggers when the player collides with it to change a boolean to activate the enemy. The trigger works perfectly, but whenever I add an if statement to check if it's the player and not anything else, it doesn't do anything
void OnTriggerEnter2D (Collider2D other if (other.tag == "Player") { Debug.Log ("We been triggered"); } }
Comment