- Home /
Dropdown not working with Oculus
Hi!
I'm trying to make a dropdown menu for a VR project I'm working on. I have set the Canvas Render Mode to World Space, and when I touch the dropdown it shows its different options. The issue I'm having at the moment is that when I touch one of the options it doesn't work. I'm kinda new to VR and Oculus so it's my first time using Unity's UI for VR.
Thanks in advance!
Answer by sybrenw · Jun 03, 2021 at 08:49 AM
I just ran into this issue as well, it seems like there is some sorting order issue with the OVRRaycaster. What I've noticed it that the dropdown automatically creates OVRRaycasters when you click the dropdown (based on the raycasters of the parents).
You can add the following code to the Start() method of OVRRaycaster.cs, which sets the sorting order if it is automatically generated (i.e. gaze pointer object is not set). It feels a bit hacky, but it seems to work:
if (pointer == null)
{
// This OVRRaycaster is probably automatically generated (i.e. dropdown)
sortOrder = 1;
// Grab the raycast pointer from parent components
var parentRaycasters = GetComponentsInParent<OVRRaycaster>();
foreach(var raycaster in parentRaycasters)
{
if (raycaster != null && raycaster != this && raycaster.pointer != null)
{
pointer = raycaster.pointer;
break;
}
}
}
Answer by lxnr-p · Aug 16, 2019 at 09:39 AM
Hi, I have the same issue here... Sometimes it works but I have to click beside the menu to select an option and not all them works properly but when I try with the mouse its works fine. I am on Unity 2018.4.6f1 with OVRCameraRig with an EventSystem with OVRInputModule attached and the OVRGazePointer. Beside that menu, everything in my UI is working fine with the controller and the GazePointer.
Do you know what could be the problem? Maybe that menu is not optimal for VR yet and if so, do you know alternative for VR dropdown menu? VRTK has no dropdown UI.
Thanks for your help!
Your answer
Follow this Question
Related Questions
Unity Dropdown - can't render unity dropdown option list in world space 0 Answers
How to get the intersection point between a UI WorldSpace with a Raycast from a Gazer ? 0 Answers
World Space UI as an in-game computer screen! 0 Answers
VR world space UI pixelated on the htc vive 1 Answer
How to make a world canvas visible only from front side in a VR game ? 0 Answers