Rigidbody2d Floating Above Ground

Hi! I’m new to Unity and I am trying to get basic 2d platformer mechanics working. However, for some reason, when using a rigidbody2d, the character floats above the ground. I can’t figure out why this is happening. If you’ve had this problem before, how did you fix it?

This is how it looks without the rigidbody2d:

And then once you add the rigidbody2d, he floats:

For anyone with this problem, go to Edit / Project settings / Physics2D and change Default contact offset closer to 0. like 0.001 and it will fix this problem.

Check and adjust your colliders of your sprite and ground, they might slightly be bigger

Exact same problem here

A simple solution is to shift your collider2d up to make up for that distance gained from the ground. This will cause your sprite to be overall slightly lower and fix the gap.

I had this issue and then realized my background object had a collider on it, no idea when/how- must’ve done it by mistake.