- Home /
How do I hide object in scene editor?
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.
Answer by Wordsonplay · Sep 04, 2015 at 03:27 AM
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.
hello, is there a way I could do this programmatically? I'm looking for an editor script for this
Answer by Bunny83 · Sep 28, 2013 at 05:19 PM
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"
Answer by Hoeloe · Sep 28, 2013 at 05:09 PM
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.
Your answer
Follow this Question
Related Questions
[FIXED & CLOSED!] How do I show and hide 3D text? 2 Answers
Re-hiding a guiTexture 1 Answer
Can you use renderer.enabled on array members ? 3 Answers
hide show canvas and ui elements at start 1 Answer
Hide GUI Text when button is pressed 1 Answer