Bug? Toggling Gizmos visibility off doesn't prevent selection of game objects

Something fairly annoying. If you disable Gizmos by toggling the Toggle Gizmos button, it doesn’t prevent selection of the gizmos. For example, here’s a game object with a box collider, no renderer, and a script that draws a gizmo:

If I click on this yellow box, it will select the object. If I remove the script with the OnDrawGizmos method on it (thus making the box disappear), I can no longer select the object by clicking in/around this area. This confirms that you can’t select a rendererless, gizmozless collider by clicking within its volume.

Now, instead of removing the script, I toggle the Show Gizmos button:

6783395--785366--upload_2021-1-30_16-20-19.png

The gizmo goes away:

6783395--785372--upload_2021-1-30_16-23-51.png

However, if I click in this area, it selects the object, even though it’s currently not visible at all. This is really confusing when you’re trying to click something, and an invisible object keeps getting selected.

This seems like a bug? I can’t think of a really convincing reason why someone would want to hide gizmos but still want to be able to click on all these invisible gizmos as they navigate the scene.

1 Like

Interesting. It seems related to the DrawCube… a DrawWireCube does not have the behavior, but it might if you are able to nail the invisible line where it WOULD be if enabled.

I did find that if you go into the details of the gizmos you can turn off JUST the gizmos for that one script. Didn’t even know that selection was possible!

I made a fresh script called ODG to test this and it shows up in the list along with my other gizmo-drawing scripts. Turning off ODG on my cube prevented its selection, even with DrawCube.

6783467--785387--Screen Shot 2021-01-30 at 12.18.21 PM.png

That’s interesting. I’m aware of the behavior of unchecking specific scripts in the Gizmos menu (which is equivalent to collapsing that component on any game object), but it’s quite interesting that doing so causes it to be unselectable by clicking in the Scene view. That’s pretty interesting, and surprising. It implies that whatever Unity does when disabling all gizmos is slightly different than what it does when disabling individual gizmos. Which maybe gives me hope that they can fix the behavior I’m considering a bug…

FWIW, I’m using DrawMesh in this gizmo. If I use DrawWireMesh instead, you’re correct that it becomes pretty much unselectable, which isn’t really what I want, since now I can’t select the object when I actually want to click on it and select it. :slight_smile:

Anyway, good points here. I think the takeaway is that disabling a single component causes that components gizmo to “do the right thing”, which disabling all gizmos at once causes the gizmos to “do the wrong thing”, and I should submit a bug report stating that disabling all gizmos should work the way it does when disabling individual gizmos.