Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable AutoEnableVR #961

Open
Mouledoux opened this issue Jun 9, 2021 · 7 comments
Open

Cannot disable AutoEnableVR #961

Mouledoux opened this issue Jun 9, 2021 · 7 comments

Comments

@Mouledoux
Copy link

Unity 2020.3.5
OpenVR XR Plugin 1.0.1

SteamVR launches regardless of SteamVR_Setting.autoEnableVR being true or false
UnityEngine.XR.XRSetting.enabled is also false at build time for all build devices.

Every single camera (except the disabled VR Player's camera) has TargetEye set to none.

XR.Enabled and autoEnableVR do get reset at runtime based on user settings,
but they are both false by default, and SteamVR launches before the scene with that script even loads.

@Mouledoux
Copy link
Author

Update:
I did not know unity 2020 changed how you activate VR from XrSettings.enabled, to XRGeneralSettings.Instance.Manager.StartSubsystem / StopSubsystem
https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.XR.Management.html

However, this still does not stop SteamVR from auto launching before that code is even called.
SteamVR_Settings.autoEnableVR is still false, as is XR Plug-in Management's Initialize XR on startup for all devices

@max-fluff
Copy link

Same problem here. I've disabled auto-enabling toggles in XR plug-in manager settings and SteamVR_Resources/Resources/SteamVR_Settings but SteamVR still runs on app start.

Screenshots

image

image

Unity ver. 2020.3.8.f1
XR plug-in management package ver. 4.0.6
SteamVR package ver. 2.7.3

@Mouledoux
Copy link
Author

I may have found part of the problem in the Player log
Player.log

You can see it initializes the subsystems, and then calls XRGeneralSettings.Awake first before anything else.

AFTER that, then you can see where I tried to stop it from happening with "SE_InitializeUnityScene:InitializeVR(SequencedEvent)"
code here:

private void InitializeVR(SequencedEvent a_event)
{
    bool _vrEnabled = MasterConfig.Instance.UnityDisplaySettings.useVR;
    XRManagerSettings _xrSettingsMgr = XRGeneralSettings.Instance.Manager;
            
    if(_vrEnabled)
    {
        _xrSettingsMgr.InitializeLoader();
        _xrSettingsMgr.StartSubsystems();
        XRSettings.gameViewRenderMode = GameViewRenderMode.RightEye;
                
        a_event.ProgressTextAddNewLine(($"VR Moduel Detected").AddRichTextTag("color", "yellow"));
        a_event.ProgressTextAddNewLine(($"\t VR Status: [ENABLED]").AddRichTextTag("color", "green"));
    }

    else
    {
        XRSettings.LoadDeviceByName("");
        _xrSettingsMgr.DeinitializeLoader();
        _xrSettingsMgr.StopSubsystems();
    }
}

Still, SteamVR should not launch automatically if autoEnableVR is false, but here we can see Unity is basically forcing VR to enable if you have any of its subsystems in your application at all.

Hopefully someone smarter than me knows what to do next, because that's all I got

@zite
Copy link
Collaborator

zite commented Jun 16, 2021

The auto enable vr checkbox is for enabling the steamvr subsystem in unity settings, not for launching it at runtime. Launching it at runtime is controlled by unity.

@Mouledoux
Copy link
Author

Ok, but both are disabled, and it's still running.
What's the proper way to prevent SteamVR from launching when my app does?

@zite zite added the Assessing label Jun 23, 2021
@nitz
Copy link

nitz commented Nov 9, 2021

Hello @Mouledoux -- I just happened upon this issue while looking for something completely else. I agree with your assertion that SteamVR shouldn't launch if auto enable vr is false, and ran into the same problem myself. I discussed it on the Unity XR Plugin page, here: ValveSoftware/unity-xr-plugin#80

@Verex found a solution that makes the OpenVR plugin obey the 'Initialize on Startup' option, and submitted it as a pull request here: ValveSoftware/unity-xr-plugin#102

It hasn't been merged, or even acknowledged, but if you download their fork it works just like it says on the tin.

@Peaj
Copy link

Peaj commented Dec 17, 2021

This could also be connected to the problem I fixed with PR #974 (isn't merged yet)
For me disabling autoEnableVR just didnt work as this setting always gets overwritten with the default value on each asset import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants