Locking a layer still being able to select an item

I put the default “Water” layer on a random GO in my hierarchy and tried to select it through the view window and I was expecting to not be able to select it but I was.

What could I possibly be doing wrong?

P.S. The GO has nothing to do with water, I just used the layer to test if it’s going to be ignored when selecting. And if I have a sprite renderer and a sorting layer, if I lock the sorting layer it works…

alt text

alt text

What’s probably happening is that the click is successfully hitting one of the boxes (which is presumably not set to the Water layer), and then the prefab instance selection logic which causes root of a prefab to be selected whenever a child is clicked kicks in, resulting in the root object being selected despite its layer being locked.

Whether or not this is the right thing to do, of course, is a whole separate discussion.