I'm trying to draw a rotating model on the GUI, so I set a new camera with orthographic view and scaled it to have the same size as the canvas, but I'm having a problem. There is a controller object drawing stuff on the OnGUI event, and this is overlapping the model on the new camera, how can I make the OnGUI stuff from the controller draw stuff behind the model on the new camera?
Tested a scene where i have my Canvas set to screenspace - Camera. You can position objects between the camera and the ui, but strangely enough, 3d objects don't follow their parent inside the canvas hierarchy
RectTransform's internal way of handling things is quite counterintuitive, I agree on that. Hovewer, I just added canvas in Screen Space - Camera, added text component to it and a cube to text component and cube moves when I move text just fine for me.
I have this hierarchy: -Canvas ->GUI Cam -->Model here the model follows the camera like it should, like if it's really in the UI, but the stuff that is drawn using OnGUI event is drawing above the model, and I don't want it to be drawn above, i want it behind the model so the model shows in first plane, but it's not working =\
Oh wait. I didn't notice. OnGUI is an old GUI, not Unity UI which uses Canvas and such. It doesn't really have a way of rendering anywhere except for overlay. If you're insisting on using it, only way I know is render GUI into rendertexture and then draw that rendertexture behind models that need to be in front. But then... Why not use Unity UI instead?
Unity UI is when you put stuff on the scene inside the canvas? I don't know what Unity UI is, I just started using Unity :s Is OnGUI bad?
Yes. In code to access it you need to have Code (CSharp): using UnityEngine.UI; - that namespace has all of its classes, components, etc. It's not bad, but it's old version of UI and has much less functionality. Not to mention it's harder to place in editor. Sometime in future it might become deprecated. The main point is, what you're struggling to do with OnGUI is easy with Unity UI.