How to make a GameObject show as part of a UI

Hi, I’m making a space exploration game, and as part of it, I want to have a UI that shows planet info along with an image of the planet (which matches the texture of the planet in the scene). So far my solution is to have a sphere be a child of a canvas, with the sphere given the texture of the planet. I know that in order for the sphere to actually show up the canvas has to be in “Screen space - Camera” mode. However, that leaves it possible for other GameObjects in the scene to clip through the canvas, which looks really bad. In “Screen space - Overlay” mode, that doesn’t happen, but of course the sphere isn’t rendered. Is there a way to do both, where the canvas is always on top of the scene, but then have the sphere on top of that? I’ve seen references to multiple cameras and layers, but I don’t really understand what they are saying, or if that would be a solution here.,Hi, I’m making a space exploration game, and part of the game is a canvas which shows planet information along with an image of the planet (which needs to look identical to the planet GameObjects in the scene). My solution so far is to have a sphere be a child on a canvas which is displayed as an overlay, with the sphere getting the planet’s texture. Now, I know that in order for a GameObject to render along with UI, it has to be in “Screen Space - Camera” mode. However that leaves it possible for other GameObjects in to be able to clip through the UI, which looks really bad. Is it possible to have the UI completely lay on top of everything else in a scene (like in “Overlay” mode), but also have a specific GameObject “on top” of that? I’ve seen references to multiple cameras and layers, but I don’t really understand what they are saying.

Use a separate camera for rendering UI only (set culling mask to only UI) and set its Depth higher than your main camera - that way it will draw over it even though it is Screen space. Then you set the Canvas to “Screen space - Camera” mode and set this camera as its camera. Finally, the main camera should not render the UI, so uncheck UI in its culling mask. Of course, your Canvas and all its children have to be on UI layer.

Another approach is to have a camera that looks at the planet draw to a render texture, and use that texture in an Image component. But this is less efficient, and less flexible.

Hi,

I have the same problem. My Instanciated things wont show up.
But I must have my Canvas set to Screen Space - Overlay or my Color picker thing wont work…for some reason.

So what can I do to make things show up on my scene with Screen Space - Overlay set on the Canvas?
If you answer, please be specific. I’m very new to Unity.

All UI must be placed inside a Canvas GameObject, or else the Camera won’t render it. The easiest way to add a Canvas is by adding a UI GameObject through the GameObject > UI dropdown menu. This will automatically add it to the scene along with the EventSystem GameObject, which is needed to handle interactivity

Dunkinrunsonyou