Search Unity

Help with VR UI

Discussion in 'AR/VR (XR) Discussion' started by GoesTo11, Jun 18, 2016.

  1. GoesTo11

    GoesTo11

    Joined:
    Jul 22, 2014
    Posts:
    604
    I need help with my UI in VR. I have a screen space UI that I need to be able to access via the keyboard and mouse. I also have a World space UI that needs to be accessible to the player via gaze or hand controllers. The screen space UI is not visible in the HMD but is visible on my monitor which is perfect and it works by default. However, if I use Oculus’s OVRInputModule or an input module written for the Vive (ViveUGUIModule), my screen space UI stops working.

    I’ve tried using Unity’s VRraycaster and VRInteractables and I can get the World space UI buttons working properly. However, I cannot get the dropdown boxes to work. I think that my main issue is that I cannot put colliders on the dropdown menu items. I also need sliders to work but I have not tried those yet. Does anyone have any ideas on how to get these working? Thanks
     
  2. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    375
    ScreenSpace - Overlay Camera mode doesn't work in VR. IIRC you can set the canvas to ScreenSpace - Camera and then sort it to get effectively the same result.

    Sliders and dropdowns are going to be rough to use via gaze. It's probably worth considering replacing these with pages and/or next/previous buttons.
     
  3. TrickyHandz

    TrickyHandz

    Joined:
    Jul 23, 2010
    Posts:
    196
    Are you removing the Standalone Input Module from the Event System? If you remove it, any "default" mouse/keyboard interactions you may expect could be stopped. You can add a new input module to the event system object without having to remove the existing standalone input module. There may be some ordering issues through, so I would recommend placing the OVR or Vive Input modules above the Standalone module. Events should propagate through each as needed, if I understand the systems correctly.
     
  4. DrHeinous

    DrHeinous

    Joined:
    Jun 25, 2013
    Posts:
    19
    Actually the events don't propagate (with multiple event system). I was having the same issue, and after research was surprised to learn that for an even system each InputModule does it's updating, but then Process, the important function where most of the selection work happens, only gets called for ONE of them.

    My hacky solution, since I was using the ViveUGUIModule code, was to simply modify that script. I added a Standalone imput module and a reference to it in the ViveUGUIModule code. And in the ViveUGUIModule Process function I added...

    otherInputModule.Process();

    ... at the tail end of it's Process call. Like I said, kind of hacky, but it actually works quite well. There is some problem with the EventSystem showing more than one selected object as highlighted that I haven't gone back and fiddled with, but it works.
     
    GoesTo11 and TrickyHandz like this.
  5. GoesTo11

    GoesTo11

    Joined:
    Jul 22, 2014
    Posts:
    604
    Awesome, thanks, that appears to work pretty well.
     
  6. GoesTo11

    GoesTo11

    Joined:
    Jul 22, 2014
    Posts:
    604
    Just an update. Even with the changes made above, I am running into problems if my screen space UI has a panel or other object that occupies the middle of the screen. It appears that ViveUGUIModule works by locking the cursor to the middle of the screen to cast the raycasts. I tried placing the screen space UI on a different layer and changing the culling mask for the ViveUGUIModule camera but that did not work and I don't know why. Does anyone have any ideas?