Before updating to Windows 10 you may need to return your Pro license. More information here

GUI behind a 3D model


I am making an inventory and armor system and I want to create a background for the inventory system, I also want a 3D view of the character contained within the inventory panel,

To do that I would need to make my 3D model infront of the GUI background and I have no idea how to make this possible, seeing as the OnGUI function always renders at the front how would I do this.

I tried using a GUITexture which I was able to get behind my object but each time I save a reload unity it is pushed to the front of the scene again infront of the 3D model of my character.

thanks for your time and any suggestions you can give Scribe

P.S. yes the model does have to be 3D if it is possible as I want to allow rotating it to see different angles

more ▼

asked Aug 20, 2011 at 03:10 PM

avatar image

7.8k 37 41 80

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

If I'm not mistaken, you'd use a separate camera for that GUI-3d object, and set it's Depth closer than anything else, so it renders last.

more ▼

answered Aug 20, 2011 at 04:29 PM

avatar image

34.7k 420 360 561

thanks for answering, could you explain how I would set this up, would I have a camera attached to the 3D model that only renders that layer?

Aug 20, 2011 at 10:06 PM Scribe

don't worry, thanks I sorted it... adding a new camera and model and set the model to a custom later made my main camera not render that layer and made the other camera only render that layer. Made the other camera orthographic and set the background to clear, and changed the normalized view area stuff so it all works now :) thanks for your help

Aug 22, 2011 at 08:41 AM Scribe
(comments are locked)
10|3000 characters needed characters left

Can anyone explain this in a little greater detail? For my situation:

I have a script using a semi-transparent black GUILayout.Box to display a wall of text. What I would like is a 3D model (the default unity Constructor for example), doing an idle animation in front of that GUILayout.Box, instead of being covered by the box.

I have a main camera, and a Constructor-only camera. I've added a new layer named "Constructor", and set the 3D Constructor model to that layer. The main camera culling mask is set for all layers EXCEPT "Constructor", and the second camera's culling mask will ONLY render the Constructor layer.

What do I do from here, to get the model to appear on top of the GUI box of text, instead of behind it?

more ▼

answered Apr 26, 2012 at 04:55 PM

avatar image


(comments are locked)
10|3000 characters needed characters left

I'm not sure about default GUI boxes but I got the GUI health texture behind my boxer by having 3 cameras. The main camera doesn't use the layer the crowd plane is on or the texture. I then had the GUI texture on it's own layer. the main camera would show everything else, then you'd have to play with the depth settings on each camera. The main camera's depth would be the closest.


Still ironing out the code before I start to finalize the graphics. Been a real pain but we've been closing in on it now.

more ▼

answered Aug 23, 2012 at 01:09 AM

avatar image

1 9 6 7

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Aug 20, 2011 at 03:10 PM

Seen: 6515 times

Last Updated: Aug 23, 2012 at 01:09 AM