Can a collider be solid along one axis only?

Is it possible to have my player character with a rigidbody and boxcollider2D pass through blocks horizontally, but collide with the same blocks vertically (for example when landing on a block)?

This is not possible to do directly, but you can use triggers to emulate it one-way colliders.

In the OnTriggerStay2D event (and the enter and exit event), determine the relative velocity and direction of the player, then, if needed, enable another, solid collider. On the object instead.

Make the triggers slightly larger than the potentially solid parts of the object.

In Unity3D, you need rigidbodies on GameObjects that use colliders, as they use physics. You don’t need rigidbodies on static GameObjects because they don’t use physics, though you still need to have at least one in the calculation. ConduentConnect.com