Why Isn't My Object isn't Colliding?

To spare the details, both have a Box Colliider 2D and the non-static one has a RigidBody 2D attached. I have it in the script so that it tells me when there’s a collision. What are some reasons this may not work?

Potential issues with collisions:

  • One of the colliders needs a rigidbody of the regarding type (2D or default 3D type)
  • Both objects need a collider of the regarding type
  • The MonoBehaviour script method needs to be of the correct type (check the docs and make sure to pick the correct version: 2D vs 3D, OnTriggerEnter vs OnCollisionEnter)
  • Often, the spelling is incorrect or the parameters are not matched up correctly within the script
  • In the Physics or Physics2D settings, the layer collision matrix must support collisions between both objects.

After looking at the posted code: You need this version: OnCollisionEnter2D

@Xarbrough this is my code
void OnCollisionEnter(Collision collisions) { colliding = true; Debug.Log(colliding); } void OnCollisionExit(Collision collisions) { colliding = false; }
Is this is what’s wrong?

The rigidbody keeps falling, with the collider, so check if the rigidbody has “use gravity” unchecked. I have never used 2D, so I am not sure if this will work or not.