Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

How to hide certain objects from the camera?

Discussion in 'Scripting' started by Jonhas, Sep 20, 2019.

  1. Jonhas


    Jul 28, 2019
    The title is self - explanatory, I'm kind of rushing and Unity Answers isn't very active so, how to hide certain objects from the camera?
  2. Joe-Censored


    Mar 26, 2013
    The easiest way is with the camera's culling mask.

    Set the objects you want to hide to a specific layer, and disable that layer from being shown on the camera.

    For example, in my game I represent objects on the minimap with different shapes, such as ships are triangles. I literally just have a giant floating triangle above each ship. The main camera though has my Minimap layer disabled, so you don't see the floating triangle. The minimap camera's culling mask just includes my Minimap layer and my terrain layer, so all you see is the terrain and the triangles, etc, etc.
    Apposl and Kurt-Dekker like this.