How would I go about setting up my interface so that I can have a gameobject in front of it, as if your previewing a weapon, your looks etc
Example:

Cheers!
How would I go about setting up my interface so that I can have a gameobject in front of it, as if your previewing a weapon, your looks etc
Example:

Cheers!
I think this will help.
Yep, I’d initially approach it as multiple cameras with different depths.
Cheers both, is there an example of how to put this together, looked up the suggested answer with interface and no results, this is a new field for me.
It’s not user interface specific. If you make a second camera in the scene, and start playing with its “Depth” and “Viewport Rect” values you should get an idea of how to start. You’ll also want to play with the culling mask after you’ve got it in position.
Ok I had a play with it, no results
Anyway just so were on the same page here, in terms of the interface I have the GUI.Window blah blah blah (So code) is this what you mean by “It’s not user interface specific”. Because as far as I am aware, there are 2 types of interface, the interface you code directly and the other gameobject interface stuff…
Bump
What I mean is that picture-in-picture style rendering (one camera on top of another) has nothing specific to do with your GUI code. It’s camera functionality. Once you’ve got that going the code to control it will be more or less the same. I’m on a tablet at the moment, so I can’t give you more specific help.
Did you try getting a picture-in-picture going with a second camera, just using the scene and Inspector? That’s your starting point, don’t worry about code until you’ve got that.
The basic idea is that you’ll have two cameras; one will have priority thanks to depth. On the the one with priority you’ll render the 3D game objects so they’ll be in front of the GUI. The GUI gets rendered onto the one that renders behind that.
what about using the new UI?
http://unity3d.com/learn/tutorials/modules/beginner/ui/ui-canvas
Yes, I have 2 cameras and played with the Mask settings. I have also found and followed the following tutorial, making the object appear as an interface worked, however half of the tutorial is out of date due to the new UI which im playing with, these are my results so far…

You’re using the World mode for your canvas right? If you use Overlay mode absolutely nothing that isn’t also in an Overlay mode canvas will be rendered in front of it.
The UI just vanishes…
Is there a tutorial on this subject, this is really hard to understand and there are just to many variables…I have no idea what im doing, I had a play with everything on the forum and…yeah…also looked online, nope
Ok, I have 2 cameras, first camera is on 1 depth and will only render X layer. Its also set on depth only (This is the camera to render the gameobject)
Then on the second camera, depth is 0 and will render everything apart from X and has a GUI Layer.
The UI is still overlapping the gameobject
It’s confusing because you’re mixing together like 3 entirely different systems here. If you’re using a canvas, then you’re using the new 4.6 GUI, which is a completely separate system from the old GUI and most of the comments and documentation for the old system isn’t going to be of much use. When you switch over to RenderMode World instead of RenderMode Overlay for the canvas, you need to set it to use a specific camera and you’ll essentially have a “distance to UI” setting for the camera → UI, and anything in between those two points will render in front of the UI you’ve made. Actually, though…
Nevermind the lengthy explanations, just go check out this page on the documentation, and go through the whole UI section. There aren’t a whole lot of scripting guides using the new UI system because 90% of the system is visual- there’s simply no need to use scripts to do the great majority of the things that you want- things that required scripts before now (so it’s like using prefabs versus pure code-creation of assets, or “the reason why we use Unity instead of just a C# editor and a compiler”).
I’m very fond of the new UI system, and once you have a good grasp on it I think you’ll really love how easy it is. You will have to do VERY little in code if you set things up right- mostly just swapping out some of your GUI assets with some of your other GUI assets and enabling/disabling gameobjects. It’s sort of fantastic. As to your specific question regarding putting a gameobject in front of GUI elements in a canvas, the easy solution might be to simply make your gameobject a child of one of the canvas objects. The only thing I’ve actually had to put in front of GUI in this manner has been a particle generator, but it was definitely possible- just be sure to use World mode on the canvas rendering and not Overlay, because again, Overlay is made to be rendered absolutely last and there’s no changing it that I know of.
You shouldn’t be using the old GUI at all. Don’t do anything for this in OnGUI(). Any tute that tells you to use that is out of date and should probably be ignored now.
The Camera component lets you render to any rectangle on the screen. In your GUI, you’ll have to figure out the rectangle of the place where you want to draw, and then use those values in the camera.
Alternatively, if you have Pro, use a RenderTexture instead.
Ah I think I see what your getting at. The RenderMode World LITERALLY is a in world gameobject, but its really a interactable interface. So in unity it would be good for interactable, Digital Clocks, PCs, KeyPads etc. However in real life, its the equivilent to a interactive hologram (Like in the Hollywood movies)
So all I have to do, is put said interface where I want and put the gameobject in front of it. (Shall I make it a child of the Canvas or leave it?)
So am I on the right track?
Also would I still need 2 cameras? Still confused on that part…
Create new canvas. Set its render mode to “screen space - camera”. Make your background image a child of this canvas.
If anyone’s reading this later, you can put world stuff in front of your GUI by doing:
1.) Set your Canvas, that contains your GUI, to have a “Render Mode” of “Screen Space - Camera”
2.) Drag your Main Camera to the “Render Camera” slot on your Canvas
3.) Make sure your world space object is in front of your Main Camera, or that it can see it at some point if the object is moving (click the Main Camera and it’ll show the little Preview window)
4.) You can move your world space object forward and back to make it in front of the GUI, or behind it (personally I’m having an object repeatedly fly in front of, then go behind, my GUI menu)
That should do it I think. If you have multiple cameras then you’ll have to tweak this, and I don’t have experience with multiple cameras, but I think the general idea would be the same. Hope that helps.