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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question VR GUI... How to properly set up?

Discussion in 'VR' started by justin_kasowski, Oct 2, 2020.

  1. justin_kasowski

    justin_kasowski

    Joined:
    Jan 14, 2020
    Posts:
    45
    So a normal screen overlay GUI doesn't seem to be supported for VR, and I'm forced to use World Space. I try setting up two cameras and overlaying the second one on top of the first one, but it seems to just get overridden by the first one.

    I need to use a separate camera for my GUI since the first camera has a shader attached to it and I don't want the GUI to use that shader. Can anyone point me in the right direction please??

    *EDIT* Instantly figured this out... I was imagining camera depth as if it was a location in space (ie. Depth of 0 is closer than a depth of 1 and would display over it). It's the opposite!! Easy fix!

    *EDIT #2* Still need help!! Apparently the second camera not having a shader attached to it is disabling the first camera's shader. Is this a bug? Is there a certain setting I need to change?
     
    Last edited: Oct 2, 2020
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,846
    Don't use two cameras. I saw the Unity Answers post linked to in the other thread, but it's just a bad idea.

    You are on the right track with a world-space canvas. Nothing else is needed (in particular, no second camera).

    I don't know what you mean about having a shader attached to your camera. Shaders are for materials, which go on objects, not cameras. Can you be more specific about what you have attached to the camera, and why it's a problem for your canvas?
     
  3. BionicVisionLab

    BionicVisionLab

    Joined:
    Jan 7, 2020
    Posts:
    1
    The shader is a material but it acts on the input from the camera (through OnRenderImage). When I add a UI to world space, the shader acts on the UI as well.

    Edit* - when I run in non VR with a screen space overlay, it acts properly. This is just a problem for VR
     
  4. justin_kasowski

    justin_kasowski

    Joined:
    Jan 14, 2020
    Posts:
    45
    This post was me, I was accidentally under my lab's Unity account.