2 cameras: 1 for GUI and 1 for GameObjects

Im using GUI to render some texture, buttons, text, etc. I need a GameObject to appear ON TOP of that things. With Unity usual behavior first render the GameObject and then, on top, the GUI (I need exactly the opposite).

Some people told me to create 2 cameras. One for the GUI and one for the GameObject. The exact words where :

just imagine 2 cameras next to each
other, one is looking at box A at
position x=0, y=0, z=0. The other is
looking at box B at position x100 y100
z100. If the first camera is set to
depth 1 and the second is set to depth
0 and the first camera is set to depth
only, When you hit play, you will see
both boxes in the scree. 2 images are
rendered by placed on top of each
other like paper.

I follow that instructions but nothing happens. Is that tip correct? Is that the way to do it? What Im missing?

EDIT: I Found this and works PERFECTLY! Unity3D: Creating a GUI with both 3D and 2D elements | 41 Post

I found this and works PERFECTLY! :slight_smile:

Couldnt you just use 2 cameras 1 with only render gui and the other with only render gameobjects or something like that?

You can use WorldSpace render mode of a canvas.

Simply put your UI behind your model. Et voila!

OnGUI code renders on top of everything and can’t be changed. GUIElements (GUIText/GUITexture), however, can be layered with separate cameras.