Search Unity

Question XR.Settings.LoadDeviceByName() not loading device

Discussion in 'VR' started by cyauai, Apr 26, 2021.

  1. cyauai

    cyauai

    Joined:
    Dec 24, 2020
    Posts:
    2
    I have tried to use XRSettings.LoadDeviceByName() but it never work. I have already check if the parameter device name is same as the current device name but nothing changes. Also, I have added the None in the sdk list

    The XRSettings.loadedDeviceName is cardboard when initiating.
    Code (CSharp):
    1. IEnumerator testThis() {
    2.   if (string.Compare(XRSettings.loadedDeviceName, "", true) != 0) {
    3.     XRSettings.LoadDeviceByName("none");
    4.     some_text.text = XRSettings.loadedDeviceName;
    5.     yield return new WaitForSeconds(1);
    6.     XRSettings.enabled = true;
    7.     some_text.text = "Device name " + XRSettings.loadedDeviceName;
    8.     }
    9.          
    10.   }
    11.  
    12.   IEnumerator temp() {
    13.     some_text.text = "Device name " + XRSettings.loadedDeviceName;
    14.     yield return new WaitForSeconds(10);
    15.     StartCoroutine(testThis());
    16.  }
    No matter how I detect, the device name is still cardboard.

    https://docs.unity3d.com/ScriptReference/XR.XRSettings.LoadDeviceByName.html

    What I have done:
    1. Make None as one of the Virtual Reality SDKs
    2. Use XR-Plugin Management
    2.1 Disable Virtual Reality Supported
    2.2 Convert camera to XR-Rig
    2.3 Use the code about turning VR off in XR-Plugin Management
    2.4 Remarks: all the procedure in step 2 is work in iOS build but fail in android build.
    2.5 https://docs.unity3d.com/Packages/com.unity.xr.management@4.0/manual/index.html
    3. Tried XRSettings.LoadDeviceByName("none"); XRSettings.LoadDeviceByName(""); XRSettings.LoadDeviceByName("None");
     
  2. rathod_009

    rathod_009

    Joined:
    Apr 14, 2021
    Posts:
    5
    Did you find the solution of this? I am getting same issue!