cancel
Showing results for 
Search instead for 
Did you mean: 

Gaze Pointers & Drop Down Boxes

sh0v0r
Level 3
When I use a Drop Down box the Gaze Pointer disappears as it hovers over the items, is this a known issue?
6 REPLIES 6

sh0v0r
Level 3
I think I've tracked it down to the OVRInputModule.GetGazePointerData

OVRRaycaster ovrRaycaster = raycast.module as OVRRaycaster;
 
overRaycaster is Null, I wonder if this has anything to do with the fact the DropList doesn't exist until it is dropped down?

sh0v0r
Level 3
OK, worked it out, the DropdownList GameObject that is created when the list is dropped down contains its own Canvas... I'll see if I can add the OVRRaycaster Component when it is instantiated...

sh0v0r
Level 3
Actually I'm a bit lost here on how best to tackle this, any help would be greatly appreciated...

lanoumbiesse
Level 2
hi....did you find the solution?

jhocking
Level 3
I may continue to look for a better way, but for now my dropdown menus are working in VR when I add this to the UI script:






    // HACK for selecting dropdowns in vr

    private void Update() {

        if (XRSettings.isDeviceActive) {

            var found = gameObject.GetComponentsInChildren<GraphicRaycaster>();

            foreach (var gr in found) {

                var ovr = gr.GetComponent<OVRRaycaster>();

                if (ovr == null) {

                    gr.enabled = false;

                    ovr = gr.gameObject.AddComponent<OVRRaycaster>();

                    ovr.sortOrder = 20;

                }

            }

        }

    }
  

Basically, the idea is to look for GraphicRaycaster components (which are on the dropdown canvases) and replace with OVRRaycaster.

OCReaper
Level 2
What you can do is add this script to your Template inside your Dropdown 
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CanvasVRModifier : MonoBehaviour
{
public GameObject pointer;
private void Awake()
{
GraphicRaycaster gr = GetComponent<GraphicRaycaster>();
OVRRaycaster OVRrc = null;
if (gr != null)
{
gr.enabled = false;
OVRrc = gameObject.AddComponent<OVRRaycaster>();
OVRrc.pointer = pointer;
OVRrc.blockingObjects = OVRRaycaster.BlockingObjects.All;
}
}
}