Search Unity

Question Possible to hide GameObject on Screen 1 but visible on Screen 2?

Discussion in 'Editor & General Support' started by KLWN, May 16, 2020.

  1. KLWN

    KLWN

    Joined:
    Apr 11, 2019
    Posts:
    35
    Hi everyone,

    is it possible to hide certain GameObjects when hitting the play button (on monitor screen) but they are visible on a second screen like a HTC Vive?

    greetings,
    Alex
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    You can do that as long as the two screens are being rendered by separate cameras. If you're just splitting the output to two monitors, then no. But, if it's two cameras, each camera can specify which layers it will render. You could put these special objects on their own layer, which only one of the cameras is configured to be able to see.
     
  3. KLWN

    KLWN

    Joined:
    Apr 11, 2019
    Posts:
    35
    thank you!

    One more thing, how is this method called to only render certain objects using layer tags?
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    It's not a method. It's just how cameras work. If you select a Camera, there should be a Culling Mask property on it. That lets you select which layers that camera will "see":

    upload_2020-5-16_12-9-10.png

    Then, for any given Renderer or SkinnedMeshRenderer, you can choose its Layer at the top-right of the inspector window:

    upload_2020-5-16_12-8-2.png

    Each camera will only render objects that are in layers that are listed among its culling mask.
     
  5. KLWN

    KLWN

    Joined:
    Apr 11, 2019
    Posts:
    35
    Thank you so much! Will try it today