Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Prevent Unity from starting SteamVR through code

Discussion in 'VR' started by Florian-Nouviale, Jul 7, 2021.

  1. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    51
    Hi !
    I'm trying to prevent unity from starting SteamVR on start for an application that could be using SteamVR (but not necessarily). I tried various things :
    SteamVR_Settings.instance.autoEnableVR = false;
    XRSettings.LoadDeviceByName("");
    XRSettings.enabled = false;

    But everytime, SteamVR starts and OpenVR says
    XR: OpenVR Error! OpenVR failed initialization with error code VRInitError_Init_HmdNotFoundPresenceFailed: "Hmd Not Found Presence Failed (126)"!
    I do not know if the start of SteamVR is linked to OpenVR trying to initialize or not

    If possible, I would like to have code that work at runtime, not changing the parameters in the editor
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    What version of Unity? Are you using XR Plug-in Management or Legacy built in VR?
     
  3. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
  4. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    51
    Hi!
    I'm targetting Unity 2020.3, so I guess XR Plug-in management is the right way to go from now on

    Thanks for the link, I completely missed this part of the documentation, I will give all that a look