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

Prevent Unity from starting SteamVR through code

Discussion in 'Scripting' 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. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,707
    Likely there is a setting somewhere that causes auto-initialization, you would need to turn that off, then conditionally start it up yourself.

    You might have more luck with this question over in the AR/XR/VR group on this biard, where folks use these APIs regularly.
     
  3. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    51
    Good point, I'll try that ! thanks !