Unity OnTriggerEnter2D not registering

There are four things I can think of which need to happen so that OnTriggerEnter gets called:

  1. The two objects’ colliders need to actually be overlapping. Just because their rendered pixels are overlapping, doesn’t mean their colliders are overlapping. This can be checked in the editor. Their colliders are indicated with a green outline in the Scene tab. If you don’t see anything, make sure the button labeled Gizmos is turned on.
  2. The two objects need to be in physics layers which are set to collide with each other. You can check this in Edit > Settings > Physics2D > Layer Collision Matrix.
  3. Both objects need to have Rigidbody2D components attached. Make sure these aren’t Rigidbody components, as those are for 3D physics.
  4. The object which contains the OnTriggerEnter2D event needs to have isTrigger = true.

Leave a Comment