cancel
Showing results for 
Search instead for 
Did you mean: 

Oculus Touch and Unity UI Buttons/UI Toggles

canonlabs
Honored Guest
I am unable to use Unity UI Buttons and UI Toggles with the Touch joysticks and Touch buttons. Is this a known issue?

Currently this breaks my game entirely since players cannot navigate the menus.
3 REPLIES 3

Glightgames
Protege
Unity doesn't support VR UI out of the box, you'll have to embed that manually.

I'd imagine for that to work, you'll need to setup the Touch controllers under 'Input' in your Unity Project so it can recognise it.

canonlabs
Honored Guest
Thanks for the reply. When navigating my Unity UI button and toggle menus via the Xbox One thumbstick, it works perfectly. But when I use the thumbsticks on the Touch, it doesn't work.

How do I get this to work?

You mentioned something about the Unity Input project settings.

dignifiedweb
Expert Protege
Oculus did an amazing blog article about Unity U.I. and using headtracking with U.I. elements. The blog post is still really useful. Since their blog post, they've been keeping their Unity Examples Framework up-to-date. Have you tried looking at their U.I. sample under the downloads section?

Here's a link to the original blog post:
https://developer3.oculus.com/blog/unitys-ui-system-in-vr/

Here's a link to the Unity Sample project:
https://developer3.oculus.com/downloads/game-engines/1.5.1/Oculus_Sample_Framework_for_Unity_5_Proje...

Don't quote me on it, but I believe it has an example of the U.i. moving around using their standard input. However, you could easily turn the head tracking example into a laser pointer like what Steam VR has. A simple test could be making a simple cube, extend it out long, parent it to the left or right touch controller, then use the cube as the raycast object instead of the head tracking. You have to take the code out that shows where the raytrace intersects with the U.i. but it only took me a couple hours to hash out an example like that, best of luck!

Also, I think what Glightgames said will work too, haven't tried it for a long time though. Go to edit --> Project settings --> Input on your project, then maybe have a look at the same settings on Oculus' Unity sample, see if they added anything special. At first glance, it appears they have specific names for their Joystick API. Oculus_GearVR_LTHumbstickX, for instance. I'm assuming that corresponds to OVRInput somehow. If you want to do a quick test with their settings in your project, you could always backup your project and copy the contents of OculusSampleFrameworkProject\ProjectSettings to: YourProjectFolder\ProjectSettings. This will copy all of the input names over, you may luck out.


Check out my Mobile VR Jam 2015 title Man Overboard! - Try the DK2 Version if you don't have a Gear VR