问题
I used a canvas and Unity UI elements as a HUD. I want HUD to be in front of everything but it's not.
回答1:
Haven't worked with Cardboard before but I beleive you can fix this with camera culling. Just follow the steps below:
Canvas:
1.Select the Canvas
and change the Layer to UI. The default is UI but make sure that it is still set to UI.
Default/Main Camera:
1.Select the Main Camera that was there already there and change the Clear Flags
to Skybox
.
2.Change the Culling Mask
to Everything
. Click on Everything
which is a setting of Culling Mask
and de-select/uncheck UI
.
3.Change Depth
to 0.
New Camera:
1.Create a new Camera
and name it UI Camera.
2.Select the UI Camera, change the Clear Flags
to Depth Only
.
3.Change the Culling Mask
to UI
.
4.Change Depth
to 1.
5.If the Canvas you want to display on top has the "Render Mode
" set to "World Space
" or "Screen Space - Camera
" then drag the UI Camera to the Canvas' Render Camera/Event Camera slot. You don't have to do this if the "Render Mode
" is set to "Screen Space - Overlay
".
That's it. This will always display the UI in the front. It should on default but its not working for you for some reason.
回答2:
Thanks to @Programmer
ı understand the general logic but if you're working on a Virtual Reality , you have to do something more .
1-) Copy the Virtual Reality Camera and apply changes @Programmer
says
来源:https://stackoverflow.com/questions/37704248/canvas-is-not-rendering-on-top