Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug XRSettings.LoadDeviceByName not working

Discussion in 'VR' started by Sam_Space, Apr 26, 2022.

  1. Sam_Space

    Sam_Space

    Joined:
    Jun 28, 2019
    Posts:
    16
    Hey, I am working on a VR game utilizing the virtual reality tool kit(VRTK). When I play the game in the editor no camera renders on the game window. In fact the specific VR sdk does not load depending whether it is steamvr or oculus. The problem is that neither of these sdk vr devices are not activated.

    I issue I find is in the scripts when XRSettings.LoadDeviceByName(*device name*) is called and a device name is passed into it to determine whether or not an oculus device or steamvr device is activated in the scene. However even though I call this function, I then call the line of code XRSettings.loadedDeviceName and it returns null or an empty string. For some reason XRSettings.loadedDeviceName continues to turn out null and I need help in understand why and how to change it otherwise.

    I've researched the issue and have not found a solution yet. I am using unity 2018.4. I have also made sure that in player settings under XR Settings that the intended vr sdk's are accounted for along with "None" and that checked box "Virtual Reality Supported".

    ------------------------
    On a similar note, this issue came out of nowhere. Everything VR was working fine for the longest time until I opened up another VR unity project in the 2021 version and was playing that in the editor. At some point the 2018 projected VR sdk stopped working fully. Not sure if this info helps understand.

    Another thing I tried was to port the base VR packages from the project to another new project and the VR runs just fine, so I am trying to understand what differences are being made.