0

I'm currently building a prototype for a project (using unity 2019.4.0f1). That means it doesn't have to be perfect and there are just a few functions involved. So far I created the environment and added a dialogue system, which pops up when the button is hit. This is working absolutely fine when I'm in Unity and try it on play mode. But when I try it out on my Oculus Quest, everything is shown correctly but I'm not able to click the button (as I did in play mode with the mouse). I'm using the custom hands and are able to grab things - but it seems I'm too stupid to click buttons. My brain tells me that there is a simple solution, but right now I'm more than desperate. I hope there's someone out there, who can help me. Btw I'm a newbie and try my best - be kind. :)

Thank you in advance!

Hierarchy

Button in play mode

Button in inspector

Geka
  • 1
  • 1
  • 1
  • Welcome to SO! Canvases don't interact with normal GameObjects, for example the hand controllers. You'll need to create a script that raycasts from the tip of the controller and checks if a UI component is hit. The code should look something like [this](https://www.youtube.com/watch?v=3mRI1hu9Y3w) (I'm sure you can find a tutorial specific to Quest though!) – yummypasta Jun 30 '20 at 01:57
  • @yummypasta thank you! Believe me, I watched so many YT videos the last 8 days, this was one of them. Although it's explained quite well, it does not work and in the end he does not show how to make the cast click on the button (if I'm not mistaken). As far as I can say, there is no specific video for the quest, that shows how to create a script for a raycast that is in the end able to click on a button. :( – Geka Jun 30 '20 at 17:42
  • Ok, actually after 1,5 weeks someone came up with a super simple answer and I think it's a shame that one needs to look so long for this simple solution: Besides the "OVRPlayerController" I added "UIHelpers". I disabled my old EventSystem (as UIHelpers brings its own) and changed the event camera of my canvas to the centereyeanchor. And that's it. So simple and yet so hard to find. – Geka Jul 05 '20 at 14:13
  • It would be great if you could post what you found as an answer below so others can solve this problem in the future! – yummypasta Jul 05 '20 at 16:35
  • @yummypasta I just did that yesterday ;) – Geka Jul 06 '20 at 17:13
  • please use the "Add answer" button below isntead of writing in a comment – yummypasta Jul 08 '20 at 01:56

2 Answers2

4

Hope you have integrated Oculus integration package. If not integrate it from Unity asset store. https://assetstore.unity.com/packages/tools/integration/oculus-integration-82022

There is a demo scene named StartScene.unity available under Assets/Oculus/SampleFramework/Usage/. This scene is already come up with basic button interaction. You can use that as a reference to get start with button interaction in Oculus Quest.

If you are interested to create a button interaction from scratch then follow the below steps,

  • Create a scene named ButtonInteractionDemo.unity
  • Add OVRCameraRig prefab into the scene and deselect Main Camera, EventSystem.
  • Add Canvas gameobject into the scene, change canvas render mode to World Space then select Event camera as CenterEyeAnchor and scale values to (0.002, 0.002, 0.002) (Fig 1).
  • Add UI Helpers prefab into the scene.
  • Select LaserPointer from UI Helpers and activate Line Renderer.
  • Add OVR Raycaster component into the Canvas gameobject and select Pointer as LaserPointer.
  • That's it. Now you can add buttons into the canvas.

enter image description here

enter image description here

enter image description here

Codemaker2015
  • 12,190
  • 6
  • 97
  • 81
0

Pretty much had the same problem 15 minutes ago. I'm pretty bad at explaining things with words but this video explains how to make it interactive. you just have to write the scripts themselves. The general idea is that Oculus kinda already did it and put it in the integration.