Draw GameObject over GUI


I wanted to ask if there is an easy way to draw a gameObject over the GUI with the new UnityGUI from 4.6. I renember that it was pretty hard to do in the past.


Place a new Camera at the edge of the Scene just where a camera looking at the new UI ends up. Now lower that camera until it’s so far below the Terrain it’s not going to show any terrain when displaying. Set the Canvas to ScreenSpace Camera and select your new camera. Set its far clipping plane to far enough to show the canvas plane distance (i.e. Canvas plane distance = 100, set far clipping to 100) also set to Orthographic(optional). To be certain it only renders the menu and 3D objects you want create a layer and set the cameras culling mask to only show that layer, put both the Canvas and the 3D objects in that group.

Create an empty GameObject between the Canvas and the camera and instantiate your 3D object there. For testing just throw a cube in front of the camera. Don’t forget to put it into that group so it renders.

I’ve used this method for months but looking at RenderTexture now 5 is effectively free. If you do decide to try 5 backup your project and then create a specific Unity5 directory for your version 5 projects and copy your project in there so you open the copy and not the old 4.6 project. You can use both on the same PC but be careful to keep the projects separate.

change Render Mode in Canvas component to Screen Space - Camera or World Space. hope helpful