Cursor sometimes disappears when moving over world space UI canvas

I’m using a world space canvas for some UI as described here: Unity UI on the HoloLens - Unity Engine - Unity Discussions

I’m also using a 3D cursor (CursorManager and GazeManager from HoloToolkit) which works just fine when pointed at 3D models.

I got it to recognize the raycast collision with the world space UI canvas by placing a Box Collider on the canvas.

This works as expected except that sometimes the cursor just mysteriously disappears when moving over the UI canvas. As far as I can tell the position of the cursor is still correct, it just fails to render. The more layered the UI controls are the more likely it is to disappear when moving over a control. The UI is mainly just a Scroll View filled with buttons that are laid out using vertical and horizontal layout groups. Some of the buttons are nested (it’s a tree view), and the more nested they are, the more likely it is for the cursor to just disappear when moving over them. If the cursor happens to disappear when at the edge of the canvas, then the part of the cursor off the canvas is still visible, and the part over the canvas is not.

This seems like a bug to me, but is there anything I could try to work around it?

1 Like

Hello,

It could be something to do with the scripts in the HoloToolKit, there might be something in the scripts that control rendering when UI is selected or could be that the cursor is farther from the camera in Z space then the button.

Thank you,
Wesley

I really doubt it’s either of those things because the non-rendering bug is sporadic. Something in the scripts wouldn’t cause random behavior. Anyway I’ve looked at the scripts and they are simple and straight forward and have nothing to do with Unity UI controls. It’s also not the Z space. There’s no reason why the cursor, when colliding with a Box Collider, would all of a sudden randomly jump through and behind it. And like I mentioned, I’m almost positive the cursor remains in the correct place, it just fails to render. This is quite obvious when at the edge of the canvas and the half of the cursor off the canvas renders and the half of the cursor on the canvas does not.

Perhaps it’s a lighting, shadow or shader issue with the cursor? I’m using the standard one that comes with HoloToolkit and I notice that the “CursorOnHolograms” (which is what’s disappearing) has shadows turned on, uses the “UI/Default” shader, and has Light Probes and Reflection Probes set to “Blend Probes”, all of which I don’t really understand.

Here’s a video that demonstrates the buggy behavior: https://dl.dropboxusercontent.com/u/2406248/UnityCursorBug.mp4

Well I worked around the problem by replacing that circular cursor that comes with HoloToolkit with another cursor model I made and using a Standard specular material.

Same issue here. Apply the worked around suggested doesn’t work.

Cursor is most likely behind the UI. IMO don’t use uGUI with HoloLens

So what do IMO use for UI in Hololens? Said my case is that the text is showing in the UI and it loaded from a text file.

How do you get to work HoloLens cursor with for example UI Button?

When I test on HoloLens button highlights, but there is no cursor on it. It appears on standard 3d objects.

@unityfearless IMO (In my opinion) don’t use uGUI with HoloLens apps. It’s a lot of overhead, and doesn’t perform optimally.

As for your cursor problem, try finding the cursor in the scene while you’ve got the button highlighted. Chances are it’s raycasting through the button and needs to be adjusted to also raycast against the UI layer as well.

@Hodgson_SDAS can you elaborate a bit more on “needs to be adjusted to also raycast against the UI layers”. An example would be awesome.
From my end, I debug and did see it hit the UI object after I add the box collider in the UI. But still see the cursor behind certain sections of the UI.

https://docs.unity3d.com/ScriptReference/Physics.Raycast.html