Disable selection of parented objects like LODs

Does anybody know of a way to make parented objects in the scene view unclickable. Something that is scene independent.

I know you can do this in the hierarchy panel, with the hand icon, but this isn’t a good solution when building a big level as you have to manually disable the child objects every time. And then for the next level you have to do this all over again.

Example… a tree prefab with 3 LOD’s… when its selected, it selects LOD0. I never want this to happen.

In 3DS/Maya it’s called freezing an object.

1 Like

You can write a custom editor script that listens to selectionChanged , just add a callback in a static method with the [InitializeOnLoadMethod] Attribute above it.
Then a simple check, if the mouse is over the scene view window and if the new selected GameObject has an LOD-Component in it’s parents → select the parent with the LOD-Component instead.
MouseOverWindow method link.

Otherwise you could try to use the SelectionBaseAttribute.

2 Likes

Thanks for the reply! I’ll give this a go!.

Sorry for the necro but I made a script for who needs it. Just place the script inside the Editor folder and you are good to go.

Also is disabled by default for performance reasons, you enable it by clicking on “Tools/LOD Selection/Toggle LOD Parent Selection”

1 Like

https://pastebin.com/GvZ0w10a - added multiple selection

2 Likes