Get WHICH trigger for OnTriggerEnter?

I have a game object with two different triggers attached, each on an empty game object, like this:

EnemyCharacter (has several colliders

->VisionParent (empty game object with a box trigger)

->MeleeRangeParent (empty game object with a sphere trigger)

With one script attached to EnemyCharacter (the parent for everything). In this script, I use OnTriggerEnter, but I need to know whether the player entered the VISION trigger or the MELEE RANGE trigger. I know you can use the parameter in OnTriggerEnter(Collider col) to check the object that entered the trigger (being col), but how do you tell which TRIGGER WAS ENTERED?

Thanks :slight_smile:

Assuming the hierarchy of your Object is EnemyCharacter with two children (VisionParent and MeleeRangeParent), each of those children should have the trigger script as well as their respectful collider. In the OnTriggerEnter() function have a switch for the tag of the object.

On the VisionParent and MeleeRangeParent change the Tag in the Inspector Window. You will then be able to tell which object the Trigger belongs to.