Home > Software design >  Unity3D: changing camera from perspective to orthographic hides UI elements
Unity3D: changing camera from perspective to orthographic hides UI elements

Time:01-25

In my project I'm using 2 cameras:

  1. the Main Camera for the scene 3D elements;
  2. a secondary camera for UI elements, which I need(?*) since I want to render 3D objects inside the UI (I followed enter image description here

    Orthographic Camera

    Inspector of one of the orthographic cameras:
    enter image description here

    UI Camera

    Inspector of the UI camera (also orthographic):
    enter image description here

    Canvas Details

    Inspector of the canvas I'm using for the UI:
    enter image description here

    I'm trying to make a sort of switch for different orthogonal projections, that makes use of different cameras to change the perspective. Therefore I made a dropdown UI element that seems to work fine: I used the gameobject.SetActive(bool) method to switch camera, even though the enter image description here

    2. Orthographic Camera

    After switching camera to orthogonal (UI disappeared): enter image description here

    And that's what I see in the Scene window: enter image description here

    Update

    Setting the Canvas "Render Mode" to Screen Space - Overlay seems to be solving the problem, but then I'm not able to see the 3D objects in the UI: enter image description here

    CodePudding user response:

    Turns out it was easier than I thought. Big thanks to enter image description here

    2. After

    enter image description here

  • Related