11
\$\begingroup\$

I'm making a game which is playable with VR and without VR. The SteamVR plugin is inside my project folders, but no CameraRig or other SteamVR object is inside my scene.

When I start the game, SteamVR starts.

How can I only activate SteamVR when I need it? (When it is checked in the settings).

\$\endgroup\$

9 Answers 9

2
\$\begingroup\$

You can disable VR support in Unity. This will disable SteamVR from starting. This can be done via code by using the VRSettings class. Specifically, the enabled value.

So, if you have two different scenes, the VR scene could set VRSettings.enabled = true; and the non-VR scene would use VRSettings.enabled = false;

Additionally, you can switch VR platforms by using something like VRSettings.LoadDeviceByName("OpenVR");.

\$\endgroup\$
3
\$\begingroup\$

For those looking in 2019, make sure that Automatically Enable VR in Edit > Preferences > SteamVR is off if you need to build also non-VR scenes

enter image description here

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This setting does not exist. \$\endgroup\$
    – Harabeck
    Feb 17, 2020 at 17:38
3
\$\begingroup\$

The only way I've found to work is to both uncheck 'Auto Enable VR' on Assets/SteamVR_Resources/Resources/SteamVR_Settings.asset and also uncheck Virtual Reality Supported on the Player Settings.

\$\endgroup\$
2
\$\begingroup\$

For those looking in 2018, here is the solution for 2018.2.6f1

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.XR;

public class test : MonoBehaviour {

    void Start () {
        XRSettings.enabled = false;
    }
}
\$\endgroup\$
1
  • 1
    \$\begingroup\$ If this ever worked it not longer does. \$\endgroup\$
    – Harabeck
    Feb 17, 2020 at 17:41
2
\$\begingroup\$

Solved

First go to Assets/SteamVR_Resources/Resources/SteamVR_Settings.asset

disable auto enable VR

then go to project settings, Player, XR Settings and disable VR Support

\$\endgroup\$
2
\$\begingroup\$

You should have a CameraRig object for your SteamVR or a normal Character controller for your Normal game mode (non-VR mode). You only require the on/off these two game-objects and need to on one game-object at a time. [more]

\$\endgroup\$
1
\$\begingroup\$

None of these suggestions work in December 2019.

The only fix I found is that you have two cameras in two different game objects, one for VR and one for non VR. Inside the Camera settings for your Non VR Object in your Inspector you just change the Target Eye to "None (Main Display)."

This should work. It did for me. I have the same game in both standard First Person and with the HTC Vive headset. You just Instantiate the Game Object with the First Person Non VR Camera settings instead of the Game Object with the VR Camera Settings when you don't want VR in the game.

\$\endgroup\$
1
  • \$\begingroup\$ Changing this setting is not sufficient. Behavior does not change. \$\endgroup\$
    – Harabeck
    Feb 17, 2020 at 17:45
1
\$\begingroup\$

In newer versions,

  1. Open SteamVR_Settings, which can be done by clicking Window -> SteamVR Input -> Advanced Settings -> SteamVR Settings. enter image description here

  2. Close the SteamVR Input window and Uncheck Auto Enable VR in the inspector. steamvr settings

  3. Go to Project Settings -> Player and uncheck Virtual Reality Support. enter image description here

\$\endgroup\$
-1
\$\begingroup\$

my oh my looks like this setting keeps moving.

Using the SteamVR Asset 2.5.0 in Unity 2019.3, the 'Auto Enable VR' setting can be found in the following Scriptable Object:

Assets/SteamVR_Resources/Resources/SteamVR_Settings.asset

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Unchecking this setting is not sufficient. Behavior does not change. \$\endgroup\$
    – Harabeck
    Feb 17, 2020 at 17:45
  • \$\begingroup\$ Did the trick in my project ;) \$\endgroup\$
    – chantey
    Jan 12, 2021 at 3:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .