OnCollisionEnter just wont work



	void OnCollisionEnter(Collision c)

Just doesnt want to work. I just started using Unity today so its probably a dumb mistake, just like when I got stuck because of the difference between Physics and Physics2D, but this time it honestly seems like something is wrong, I have read every subject I found on this and nothing works.

My project is simple, its a 2D Arkanoid game, both the paddle and the ball are non-kinetic (the paddle is instead unaffected by gravity and weights 100000kg, provisionally) and the tiles are kinetic. That code is in the ball’s script (in which other methods work) and I never get the “hit” debug message not even when the ball hits the paddle, I wonder why

Thank you

edit: adding a second circle collider, setting that one to Trigger and using OnTriggerEnter wont work either …

My guess would be that you have 2D physics components attached (CircleCollider2D), while in order to capture those components events, you need to do:

void OnCollisionEnter2D(Collision2D c)
//code here

Hi, try to check what kind of collider you have in the GameObject, why this?, because unity have a rule about colliders:

  1. BoxCollider with BoxCollider = X
  2. BoxCollider with SphereCollider = O
  3. SphereCollider with SphereCollider = X
  4. SphereCollider with CapsuleCollider = O
  5. CapsuleCollider with CapsuleCollider = X
  6. Rigidbody with Rigidbody = O
  7. Rigidbody with any other = O

You can even have any collider type with a Rigidbody on the same GameObject, but this require advanced physics adjusts.

Hopes this helps, cheers.