oculus-samples / Unity-StarterSamples

This repository brings multiple samples that can help you explore features and bring them into your project.
Other
142 stars 40 forks source link

OVRPlugin.GetSystemHeadsetType() always returns Oculus_Quest_2 when using OpenXR Plugin #15

Closed WikkidEdd closed 4 months ago

WikkidEdd commented 6 months ago

Description

When switching to the OpenXR Plugin OVRPlugin.GetSystemHeadsetType() always returns Oculus_Quest_2 even when using other devices such as the Quest 3

This is significant because when using the interaction package this function call is used to determine which controllers to show the users by OVRControllerHelper.

Using the Oculus XR Plugin the OVRPlugin.GetSystemHeadsetType() returns the correct headset type.

Setup

Unity: 2021.3.36f1 Packages: Meta XR Core SDK v 62.0.0; OpenXR Plugin 1.10.0; XR Plugin Management 4.4.0 Device: Quest 3, OS version 63.0.0.399.366

Repro

Add the following script to the sample project

using TMPro;
using UnityEngine;

public class GetSystemHeadsetType : MonoBehaviour
{

    TextMeshPro _text;

    // Start is called before the first frame update
    void Start()
    {
        var go = new GameObject("Debug Text");

        _text = go.AddComponent<TextMeshPro>();
        var rectTransform = go.GetComponent<RectTransform>();
        rectTransform.position = new Vector3(0, 0.8f, 1);
        rectTransform.localScale = new Vector3(0.02f, 0.02f, 0.02f);
        rectTransform.sizeDelta = new Vector2(50, 5);
    }

    // Update is called once per frame
    void Update()
    {
        _text.text = $"GetSystemHeadsetType {OVRPlugin.GetSystemHeadsetType()}";
    }
}

Expected Results

OVRPlugin.GetSystemHeadsetType() returns the headset type the app is running on, as it does with the Oculus XR plugin.

Actual Results

OVRManager.IsPassthroughRecommended() always returns Oculus_Quest_2

Workarounds

The cause of this bug seems to be due to the missing OpenXR extension XR_META_headset_id. You can create a custom OpenXR feature (as mentioned in this issue #12) which includes that extension and the call to OVRPlugin.GetSystemHeadsetType() now works

AlexThiv commented 4 months ago

This as been resolved as of SDK v66. If you encounter any additional issue you can open a new issue.

BenIVRE commented 1 week ago

This as been resolved as of SDK v66. If you encounter any additional issue you can open a new issue.

We're still seeing this issue on v69

tsaileo-meta commented 5 days ago

We're still seeing this issue on v69

Hey! Curious if you saw any logs in adb that said anything about the XR_META_headset_id extension? The MetaXRFeature.cs should contain the new XR_META_headset_id extension that should allow for the correct headset type in OpenXR. If this extension isn't enabled there's a fallback to the old system which doesn't contain Quest 3.