Character controller and collider no collision is being detected

Hi all. I have the following scenario: Its a 2D not 3D

  • I have a Player game object with a set tag and I’ve attached a character controller.
  • I have an Enemy which consist of one large Box shape and a “hand” that is a child circle.
  • Now the hand has attached a circle collider which is set to trigger. The idea is that once the hand collides with the player it should do damage to the player.
  • To the hand I attach a script which calls OnTriggerEnter2D(Collider2D collision) however no collision gets detected.

Can somebody explain to me what I am doing wrong?

EDIT: I found the issue it is not the missing rigid body component. Since my player had character controller component rigid body is not needed, however character controller uses a capsule collider to which is a 3D collider and the other object was using 2D circle collider. That was the sole reason why collision was not detected.

One of the objects need to have a Rigidbody2D component in order to trigger the event.

From the documentation for OnTriggerEnter2D()
Note: Trigger events are only sent if one of the Colliders also has a Rigidbody2D attached. Trigger events are sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.

You need to attach Rigid Body 2D and check the Is Trigger ☑ box in the hand Collider to make it work.