I’d like to hide some gameObjects in scene editor; currently I’m placing “empty” gameobjects around my ship to simulate floating, but water, islands etc interferes my working. Now I disable mesh renderers from gameObjects I don’t need to see or edit, but then those will not show up when I test my scene.
There has to better way, help please?
Also I’d like to have option to lock some objects. I want to see my ships hull, but not select or move it while editing those “floter” points. It’s frustrating to spend most of time to find good viewpoint so I can select specific object.
The Layers button in the top-right of the Unity editor window allows you to choose which layers you want to see in the scene view. So you can put your ship in a separate layer and then hide it. You can also ‘lock’ layers, so they are visible but can’t be selected.
Rather than specifically disabling mesh renderers, just disable the entire object, or better still, put them all as children of an empty object, and disable that. Then, re-enable it just before testing your scene. Unity does not have a built-in “lock” setting, but there are editor scripts you can download to do it, or you could write your own.
You can’t really “lock” gameobjects, but you can hide them or prevent editing in the inspector by setting the hideFlags. Watch out since the hideFlags also controls if the object is serialized or not.
The HideFlags is a bitmask, so you can combine them with the binary or “|”:
public enum HideFlags
HideInHierarchy = 1,
HideInInspector = 2,
DontSave = 4,
NotEditable = 8,
HideAndDontSave = 13
HideAndDontSave is already a combination of “NotEditable”, “DontSave” and “HideInHierarchy”