On Trigger Enter not working

I try to make interaction between player andenemy so I use On Trigger Enter. It’s not working and here a debug code:
Code (CSharp):

Both Object player and enemy has Collider attached. Enemy object also has Trigger selected.

I have no idea what causing it not to work. I’m working on 2D project. It used to work on 3D project.
Additionally, On Collision Enter also not working. I ran out of idea that why I come here.

Have you tried OnTriggerEnter2D?

For 2D physics, OnTriggerEnter2D is the correct one.

Thank you, mate. It work perfectly now. I didn’t know there is a different use between 3d and 2d.

If you look in your colliders or physics menus you’ll notice that there are different types of colliders and so on that operate a similar way, Rigidbody and Rigidbody2D and so on, it’s just something to bear in mind when working in 2D or 3D.

1 Like

If both GameObjects have Collider.isTrigger enabled, no collision happens

One is collision, the other is collider. One needs to be a trigger for the other to work.