I am unable to interact with buttons in VR (Oculus)

posted to: Interactive Buttons

I have the canvas set to World Space and have the Center Eye Anchor (Camera) set as the Event Camera. I attached objects to the Left and Right Hand Anchor of the OVRCameraRig but I am completely unable to interact with the buttons on the canvas. Any suggestions?

  • Jonathan Gonzalez(jgonzalez) replied

    UI within VR needs to be more "physical". The default UI system uses a mouse hover or touch on a screen to determine if the player is interacting with it, but with world space elements it acts like a 3d object so it doesn't know when you're "hovering" over a button. 

    You'll need to use a raycast along with a line renderer (to see it more clearly in game) to simulate a laser pointer. Then with that raycast you can detect the button. 

    A more physical way is to use 2D sprites as game objects with a collider. Players can then physically reach out and press them or also use a raycast. I can write up an article on creating VR based UI systems to better explain it. I have worked with UI quite a bit in VR lately so it'll be good to get that "on paper" for others to learn from as well. 

  • Hunter & Tiff Eidmann(eithman) replied

    Thanks! You gave me a few different ideas! And having that article would be excellent! A lot of unity tutorials don't translate perfectly to VR so the more there is to explain the transition, the better :)

  • Jonathan Gonzalez(jgonzalez) replied

    It's true. The thing about VR is that it isn't really that much different than typical game development environments, with VR it's more physical and "realistic". So same concepts can be applied to any game, but with VR there's less "smoke and mirrors" and more direct interactions. I'm already drafting up the idea for an article on the subject!