Hide gameObjects from game camera or scene-view
Sometimes you want to show or hide some gameObjects without actually desactivating them in the hierarchy.
This article show 2 built-in methods to do the following:
Hide gameObjects from the Main Camera
First, you need to create a Layer named
Go to the layer tab, and create a new Layer. Then apply this layer to all gameObjects
you want to hide from the game camera
gameObejct to hide:
Here is where the magic append, select your main camera, and disable from the culling mask the layer
Enjoy the result below.
Hide gameObjects in the scene view
There is 2 ways on hiding gameObject in the scene view in unity.
First, you can choose to hide an entire layer. Notice the
next to each layer. You can click on them to hide, or show all the gameObjects on these layer.
By the way, you can also lock them, to disalow the selection in the scene view.
The second method required the last version of Unity. Since Unity 2019,
you can also hide individually each gameObject, by clicking on the little
eye next to each gameObjects.
If you have gameObjects not shown in the game, you could also tag
(with tag, not layer)
to simply remove them from the build.
More Info in my article below.