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

Can I stop SteamVR from reenabling XR support?

Discussion in 'VR' started by illinar, Nov 29, 2018.

  1. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    I need to quickly iterate on my game in the editor to test things, so I disable XR and watch it in scene view, but something (gotta be SteamVR from github) keeps reenabling XR support which forces WMR to start when hitting Play and it is slow every time. How can I avoid it?
     
  2. TenFiddy

    TenFiddy

    Joined:
    Sep 28, 2017
    Posts:
    21
    Same here- what I did was unplug my WMR headset. It seems that the XR support checkbox will magically be selected after 30 minutes or so, ifthe HMD is plugged in. Hopefully it will be fixed in the future.

    And disable the VR camera rig and turn the main back on.

    BTW - this only happens with the Windows Mixed Realty headset, not my Vive. So I don't think its steam.
     
  3. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    Interesting. Well, I can't unplug, it's too hard to reach. Maybe there is another way to disable the headset.. That still has to be SteamVR because I don't imagine Unity assumes you are making a VR game just because you happened to have a WMR headset pugged in :) Unless you don't have steamVR installed and are still getting the same behavior.

    I guess I can disable it in Device Manager.
     
    Last edited: Nov 30, 2018
  4. TenFiddy

    TenFiddy

    Joined:
    Sep 28, 2017
    Posts:
    21
    I have the WMR Steam VR version installed. On another system, I just have regular steam VR. No problems on the regular steam VR version.

    To get around it I just look a it every 5 minutes or so, when testing, and uncheck it when it automatically come on again. Because - I'm lazy too. I hate reaching around to the back of my computer to disconnect. But I love to flip up my Lenovo Explorer and make changes.

    In the mean time, I think I will buy a HDMI extender and put it on top of my rig to facilitate my laziness - lol

    BTW - I think windows almost got a lot of things right with their MR. Except the name, and putting me in that stupid house at startup, and hiding the adjustments for the floor settings, and thinking I want to talk to catana to use VR, and I have no IPA adjustment...

    Let me know if you find a place to post to ask for a fix and I'll join you.
     
  5. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    My fix will probably end up being an HDMI extension as well :)
     
  6. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    I found two quick solutions.

    1) Comment out everything inside AutoEnableVR() upload_2018-12-1_22-41-10.png

    Use this to quickly toggle:
    Code (CSharp):
    1. #if UNITY_EDITOR // Or put in the Editor folder
    2. public class XRMenu
    3. {
    4.     [MenuItem("XR/Enable")]
    5.     static void Enable()
    6.     {
    7.         PlayerSettings.SetVirtualRealitySupported(BuildTargetGroup.Standalone, true);
    8.         Debug.Log("XR suppport enabled.");
    9.     }
    10.  
    11.     [MenuItem("XR/Disable")]
    12.     static void Disable()
    13.     {
    14.         PlayerSettings.SetVirtualRealitySupported(BuildTargetGroup.Standalone, false);
    15.         Debug.Log("XR suppport disabled.");
    16.     }
    17. }
    18. #endif

    2) And before I found that, I made this script:

    Code (CSharp):
    1. #if UNITY_EDITOR
    2. using UnityEngine;
    3. using UnityEditor;
    4.  
    5. [ExecuteInEditMode]
    6. public class ShutUpXR : MonoBehaviour
    7. {
    8.     public bool EnableVR;
    9.  
    10.     protected void Update()
    11.     {
    12.         PlayerSettings.SetVirtualRealitySupported(BuildTargetGroup.Standalone, EnableVR);
    13.     }
    14. }
    15. #endif
    Use it if for some reason you can't find where it gets enabled.

    Use "PlayerSettings.virtualRealitySupported = false;" instead if need to disable on all platforms.
     
    Last edited: Dec 1, 2018
    TenFiddy likes this.
  7. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    I made a slight modification to @illinar for it to work with SteamVR plugin.

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3.  
    4. #if UNITY_EDITOR // Or put in the Editor folder
    5.  
    6. public class XRMenu
    7. {
    8.     [MenuItem("XR/Enable")]
    9.     private static void Enable()
    10.     {
    11.         Valve.VR.SteamVR_Settings.instance.autoEnableVR = false;
    12.         PlayerSettings.SetVirtualRealitySupported(BuildTargetGroup.Standalone, true);
    13.         PlayerSettings.virtualRealitySupported = true;
    14.         Debug.Log("<color=green>XR suppport enabled.</color>");
    15.     }
    16.  
    17.     [MenuItem("XR/Disable")]
    18.     private static void Disable()
    19.     {
    20.         Valve.VR.SteamVR_Settings.instance.autoEnableVR = true;
    21.         PlayerSettings.SetVirtualRealitySupported(BuildTargetGroup.Standalone, false);
    22.         PlayerSettings.virtualRealitySupported = false;
    23.  
    24.         Debug.Log("<color=yellow>XR suppport disabled.</color>");
    25.     }
    26. }
    27.  
    28. #endif
    Code (CSharp):
    1. Valve.VR.SteamVR_Settings.instance.autoEnableVR = true;
    You can do this manually and leave auto enable off by going to Assets/SteamVR/Resources/Settings (ScriptableObject) and turning it off there.