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

Resolved XRSettings.LoadDeviceByName not working,

Discussion in 'XR Interaction Toolkit and Input' 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.
     
  2. VRDave_Unity

    VRDave_Unity

    Unity Technologies

    Joined:
    Nov 19, 2021
    Posts:
    260
    Hey @Sam_Space,
    What VR runtime/version are you running against? Since 2018 is out of LTS now, I am wondering if some of the underlying runtime support is also broken. If you have more details, perhaps we can help diagnose what's going on.
     
  3. Sam_Space

    Sam_Space

    Joined:
    Jun 28, 2019
    Posts:
    16
    Howdy @VRDave_Unity

    I am running a version of vrtk that is around 3.0 and a steam VR plugin package from before 1.25. So it's some old tech. I ended up doing a couple things to work around the issue.

    One thing I did was couple all the VR components in the project, export it to a custom unity package and import it into a new fresh project with the same version. I noticed when re-importing and playing that the issue was gone. So I concluded it had nothing to do with the archaic versions of everything. However this is not a method I wanted to follow through with since the project is quite large.

    The next method that happened to work was checking the components int he project such as oculus utilities, steam vr plugin, etc and downloading the new updated versions. This threw many errors. I went through each error to resolve the issues. Afterwards the VR scenes worked fine again and the previous issue was no longer present. In fact we updated the unity project version to 2019 LTS and everything still worked.

    In the end, I don't know what was exactly causing the issue unfortunately.
     
  4. VRDave_Unity

    VRDave_Unity

    Unity Technologies

    Joined:
    Nov 19, 2021
    Posts:
    260
    I'm glad you were able to get this project up and running again. It's a bummer we don't know what ultimately caused the issue, but my guess is that some configuration or cache got into a funky state and refreshing the packages was probably the right step to follow to force it to reinitialize the configuration.