Can I show an object in scene view but not in game?

Hello all,

I can think of a couple of situations where I would like to see a object (a model, cube, what ever) in the scene view that might not be there in the game when it runs/loads.

1 - An enemy spawn point, would be nice to see it in the designer but not in game.

2 - Generating random maps where an object might be 1 of many objects.

How do I do this? Is there a better way than having a script delete an object in Awake()? If I do have to delete an object in Awake() will this effect performance?

Cheers,
Sam

Yes, it’s very simple using Unity Layers.

Here is the step by step guide :

  1. Create a cube in an empty scene as your spawn point for example
  2. In the inspector, under the cube’s name, open the “Layer” menu and Add a new layer called “EditorOnly” Layers
  3. Select again the cube, and choose the new layer in the “Layer” drop down menu
  4. Select the camera of your scene, and in the inspector, simply uncheck the “EditorOnly” layer in the Culling mask field Culling mask

Don’t forget to do the 3rd step for every object to show only in the editor and the 4th step for every camera in your scene.