How to select the camera to draw the GUI ?

Hi all.

I've read many questions to draw 3D Elements on Gui without the render to texture.

I've found this solution : GameObject Over GUI

Now I've my two camera and my 3D object an this place on the screen.

But the GUI is always draw on the "top" of the view, I got this :

  • Camera
  • 3D Object (Second camera)
  • Gui

But I wan't to get this :

  • Camera
  • Gui
  • 3D Object

I've try with GUI.depth but doesn't work.

So : How can you link the Gui to a specific camera ?

Thank you !

Actually, when you are using UnityGUI (the standard way of implementing GUIs in Unity), it is not related to any camera at all. It's actually drawn after all cameras have rendered.

GUI.depth is only for the depth inside the GUI-framework; so that defines in which order the GUI objects are drawn but it's not related to the cameras.

You might have to consider using a gameobject based GUI system (like e.g. EZ GUI) to accomplish what you want.

i thinks u have to chek what camera is active then activate the GUI.

You could try to use 2 cameras (untested):

First (GUI-Cam):

  • with GUILayer

  • clear to skybox or solid color

  • lower draw order (depth)

Second (3D-Cam):

  • no GUILayer

  • clear to “depth only”

  • higher draw order

Can u provide some more information and explanation . How to draw 3d object on a screen which is full of GUI.DrawTexture . GUI.DrawTexture is covering the entire screen and on top of that screen i want to draw 3D object .