Box Collider 2D does not work

Hi, I was making a game to catch up with Unity since it had been a while since I hadn’t opened it, the thing is that the game worked perfect but after I closed and reopened the project the character even if he has the collision active does not stops on the ground but passes through and falls off the map. Anyone know how I can do? I am attaching the images of how I set up the 2d collider box. The image that contains the 2D Rigidbody is the player


The BoxCollider2D isn’t a special thing to the physics system so if it doesn’t work, no polygons would work. It’ll be how you’ve configured it but you’ve provided no information whatsoever so it’s impossible to help.

I am attaching the images of how I set up the 2d collider box. The image that contains the 2D Rigidbody is the player

7638880--951487--Immagine 2021-11-08 163148.png
7637701--951496--Immagine 2021-11-08 163218.png

No configuration on the BoxCollider2D would stop it working unless you made it too small and that gives you a warning in the inspector.

Make sure the layers of these two objects are set to actually collide. I presume you know how to set this part up.

Your objects are tiny and your ground is super thin (0.17f). It is highly likely you are simply passing through the ground by never actually intersecting with it.

One approach is to change the Rigidbody’s collision detection mode to Continuous instead of Discrete.

Collider need Rigidbody component on it!!!
I also found this issue too, you need to add Rigidbody to everything that has a colliders.

if 2D collider also need 2d rigidbody!!!

2 Likes

Ignoring the necro, this isn’t a true statement without context.

1 Like

I do not, how would you do this?

Please don’t necro threads like this, create your own to ask your own questions.

How to set what collides with what is covered in all the basic physics tutorials. You use the Layer Collision Matrix in combination with Layers on the GameObjects.

Thanks.