Hi everyone,
I’m currently developing UI on a project and have encountered a bit of a snag in one of my current problems.
I’m intending to put 3D objects onto a canvas such that that are part of the UI. I investigated camera stacking a bit, but have learned that camera stacking isn’t yet supported with LWRP. You can read more about that here: https://forum.unity.com/threads/glitching-with-multiple-cameras-lwrp.592477/
My current situation is this:
I have a screen overlay canvas for all UI elements. I have a prefab piece of UI that is dynamically added to the canvas as needed. Part of this prefab is a 3D model that is supposed to represent objects that the player character picks up. The model needs to be part of the UI prefab to preserve its position and sit alongside text and numerical information over the player character, like the amount of currency the player has picked up off the ground at some moment. So, I have 2D and 3D elements taking up canvas space as part of the same prefab.
I have tried separating the canvas into two unique canvases. The second [new] canvas was a camera overlay. Then, I created a second camera specifically to attach to this new canvas. I was intending on using the Clear Flags on this camera so that the 3D UI could sit over the other camera’s render, but due to the previously mentioned issue with LWRP, Clear Flags are not supported as far as I know.
With my current set up - one canvas, one camera - I can see all of the 2D elements on the canvas, but none of the 3D elements. The 3D and 2D elements are part of the same object / prefab on the canvas, but I can only see the 2D parts of it in the game view. It is also worth noting that the 3D object is visible as intended in the scene view, but not the game view.
Has anyone attempted to solve a similar problem using LWRP? I would really appreciate some insight on drawing 3D objects on a canvas. More curiously, I would like to know why they are visible on the canvas in the scene view, but hidden in the game view.