I have a scene GUI with elements generated in OnGUI function and have just added UI elements from the new 4.6 UI menu system. How to make the UI elements appear on top of the OnGUI elements?
I have found a way, but requires setting canvas.RenderMode to WorldSpace and setting a separate camera to render the canvas.
The steps are:
1.Setup the canvas.RenderMode to WorldSpace
2.Place an aditional camera to the scene with:
- Clear Flags set to Depth Only
- Culling Mask set to UI
3.Uncheck UI in the MainCamera Culling Mask
4.At the end end of the OnGUI function put:
additionalCamera.Render();
All that results in canvas being rendered on the top of OnGUI elements