Search Unity

Cursor sometimes disappears when moving over world space UI canvas

Discussion in 'VR' started by smenyhart, Jun 8, 2016.

  1. smenyhart

    smenyhart

    Joined:
    May 6, 2016
    Posts:
    45
    I'm using a world space canvas for some UI as described here: http://forum.unity3d.com/threads/unity-ui-on-the-hololens.394629/

    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?
     
    DennisAtmo likes this.
  2. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    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
     
  3. smenyhart

    smenyhart

    Joined:
    May 6, 2016
    Posts:
    45
    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.
     
  4. smenyhart

    smenyhart

    Joined:
    May 6, 2016
    Posts:
    45
  5. smenyhart

    smenyhart

    Joined:
    May 6, 2016
    Posts:
    45
    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.
     
  6. unityfearless

    unityfearless

    Joined:
    Mar 26, 2013
    Posts:
    19
    Same issue here. Apply the worked around suggested doesn't work.
     
    Last edited: Sep 7, 2016
  7. Hodgson_SDAS

    Hodgson_SDAS

    Joined:
    Apr 30, 2015
    Posts:
    123
    Cursor is most likely behind the UI. IMO don't use uGUI with HoloLens
     
    Last edited: Sep 8, 2016
  8. unityfearless

    unityfearless

    Joined:
    Mar 26, 2013
    Posts:
    19
    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.
     
  9. GKiernozek

    GKiernozek

    Joined:
    Nov 16, 2013
    Posts:
    39
    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.
     
    Last edited: Sep 8, 2016
  10. Hodgson_SDAS

    Hodgson_SDAS

    Joined:
    Apr 30, 2015
    Posts:
    123
    @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.
     
  11. unityfearless

    unityfearless

    Joined:
    Mar 26, 2013
    Posts:
    19
    @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.
     
  12. Hodgson_SDAS

    Hodgson_SDAS

    Joined:
    Apr 30, 2015
    Posts:
    123