Gaze Pointers & Drop Down Boxes — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Gaze Pointers & Drop Down Boxes

sh0v0rsh0v0r Posts: 498
Art3mis
When I use a Drop Down box the Gaze Pointer disappears as it hovers over the items, is this a known issue?

Comments

  • sh0v0rsh0v0r Posts: 498
    Art3mis
    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?
  • sh0v0rsh0v0r Posts: 498
    Art3mis
    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...
  • sh0v0rsh0v0r Posts: 498
    Art3mis
    Actually I'm a bit lost here on how best to tackle this, any help would be greatly appreciated...
  • lanoumbiesselanoumbiesse Posts: 2
    NerveGear
    hi....did you find the solution?
  • jhockingjhocking Posts: 9
    NerveGear
    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.
  • OCReaperOCReaper Posts: 5
    NerveGear
    edited February 16
    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;
            }
        }
    }

Sign In or Register to comment.