- Home /
Render ortho GUI by GameObjects
Hi. I need to render 2D ortho GUI togather with 3D scene content. I don't want to use Unity GUI for this interface for some reasons.
How can I render ortho 2D GUI after 3D scene objects? Is it possible to setup camera render part perspective and part ortho?
Answer by niX_BB · Aug 01, 2011 at 11:13 AM
You would need to setup two cameras in your scene - a perspective camera for the game view and an orthographic camera for the GUI.
The perspective camera should have a depth smaller than the ortho and the ClearFlags should be set to Skybox or Solid Color to clear the background.
The ortho camera would of course have a depth greater than the perspective camera (meaning it should be rendered after the perspective) and the ClearFlags should be set to Depth Only or Don't Clear - depending on your specific scene.
Something else to consider would be to place all your GUI objects into their own layer and exclude the layer from your perspective camera's Culling Mask, and set it as the only layer in the Culling Mask your ortho camera.