I currently have an enemy that upon collision kills the player with a kill script, I want to add another collider that acts as the visibility radius for said enemy. However, when adding another colldier with a bigger x radius, the collidier still kills the enemy. Is there any way to assign particular colliders specific methods using

OnTriggerEnter2D (Collider2D var)

1 Answer 1


First its good to note the difference between Colliders and Triggers

  • Colliders - generally are intended to represent physics interactions, so objects "colliding with them" should not pass through one another. As opposed to...

  • *Triggers* - as the name implies, "fire" off an event but don't carry the typical physics body interactions

Triggers and colliders also send different events upon interaction, and the same can be said as well for 2D and 3D objects

OnTriggerEnter: 3D | 2D

OnCollisionEnter: 3D | 2D

Knowing this there are a few ways to approach this problem. First like you suggested you could add a second collider to the enemy, and from that new Collider's Component Inspector on the enemy check the isTrigger box marking it as a "Trigger".


That will allow it to instead respond to the OnTriggerEnter Method (if it is a 2D Collider OnTriggerEnter2D)

You could also organize your Enemy GameObject with a hierarchical structure

Enemy Game Object Parent
    - Damage Collider Object Child
    - Sight Radius Object Child

and then adjust the organization of your scripts to only have the kill script on the collider which should kill the player. This way you could use Triggers or Regular colliders.

  • \$\begingroup\$ I like the object hierarchy approach myself \$\endgroup\$ Commented Apr 29, 2015 at 14:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .