- Home /
Trying to put a 3D object above GUI for Hololens
Hi, I'm kinda new to Unity and I've been facing this problem recently. I have a 3D plane, a cursor wich is a 3D object, and two buttons on a Canvas, accting as a Menu. When I move around, I can see the cursor on the surface of the plane, but when it gets to the buttons, it looks like it hides behind the buttons, but it allows me to click on them. So I have a cursor that "works" , I can click on the buttons when I'm on then, but it's not being shown above these buttons so the user can see the cursor.
I'm programming for Hololens so I've got the canvas "render mode" set to World Space, using the Main Camara as the event camera. The Main Camera need to have the "Clear flags" to solid color and with color black, so I can see the room where there is black in the project.
This is a image of my problem. I want the cursor to be seen above the button. Any ideas?
Answer by aqiu384 · Feb 08, 2017 at 09:25 AM
I solved this problem using an additional camera:
Add a new layer "Cursor" and move just the cursor object to this layer.
Set the main camera to draw all layers except Cursor.
Create another camera. Set the Clear Flags to "Depth Only", Depth to something > main camera depth, and Culling Mask to just the Cursor layer.
Under this configuration:
The main camera goes first, drawing everything but the cursor layer.
The secondary camera goes next, clearing the depth buffer of the main camera, and draws just the cursor on top of everything else. The ray cast from the Gaze Manager should make the cursor approximately the right size.
Your answer
Follow this Question
Related Questions
Why isn't curved UI asset working? 0 Answers
Find GUI Button and Assign Text 1 Answer
GoogleVR handling Close button in Stereo mode 2 Answers
How to have correct color on imGUI Buttons (as dynamic textures) avoiding multiply effect ? 1 Answer
How to make 3D button in Unity?,How to create Unity 3D button? 0 Answers