How to make an object only collide with certain layer?

well the title of this thread says it all.

You cannot do layerMask filtering with colliders, so therefore, you can’t decide on collisions based on layers. been needing this myself for ages, but it’s not possible.

You can set the Ignore Physics Collisions to call objects that are NOT in that layer by making a collection of the game objects not in that layer, and iterating through them finding their colliders and ignoring them… yes, I agree, a Yuck solution.