Skip to main content
sh0v0r
Up and Coming
July 2, 2016

Gaze Pointers & Drop Down Boxes

When I use a Drop Down box the Gaze Pointer disappears as it hovers over the items, is this a known issue?
    This topic has been closed for replies.

    6 replies

    sh0v0r
    sh0v0rAuthor
    Up and Coming
    July 2, 2016
    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
    sh0v0rAuthor
    Up and Coming
    July 2, 2016
    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
    sh0v0rAuthor
    Up and Coming
    July 2, 2016
    Actually I'm a bit lost here on how best to tackle this, any help would be greatly appreciated...
    New Participant
    February 2, 2018
    hi....did you find the solution?
    Participant
    September 1, 2018
    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.
    newArteest | blog
    New Participant
    February 16, 2019
    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;
    }
    }
    }