Ignore collision for all except one

Hello, I’m making a 2D game and I want a GameObject to ignore all collision except one (the ground). How can I do that?

put your object on a layer and ground on another layer use collision matrix and uncheck collision between them