2D colliders not detecting collision

Hello everyone!

Im new to unity and coding in general and i’m running in to an issue i cant seem to figure out.

I’m trying to make a simple 2d platformer game to get going with learning so i’ve been following videos and looking online for help. My problem is that i’ve attached a 2D box collider and rigidbody to my player as well as a 2d box collider to the ground sprite and when i hit play the character falls straight through. But if i add a regular 3D collider and 3D rigidbody to everything, it all works fine. Ive checked the layers (maybe i dont have them set up right) and ive tried making the player’s collider a trigger as well.

Does anyone know why this would happen?
Also, is it bad practice to use 3d colliders with small Z values in a 2d game to get around a problem like this?

I added pictures of my setting if it helps.

Thank in advance for any help!!!

Welcome.

Going to need slightly more information, because what you show should work. Can you share your scene file?

1 Like

Your ground object has a 3D collider in your screenshot, it should have a 2D collider. The 3D and 2D physics systems do not interact.

2 Likes

Ok idk what happened but i mistakenly left the 3d collider on the ground while testing to see if 3d colliders would work. for some reason after i changed it back to a 2d collider it started working. i know that it should work i just don’t know how its working all of a sudden because i know for a fact had 2d colliders on everything the first time i tried it.

But anyway im glad its working now and Thank you guys for the help!!

1 Like