Search Unity

Resolved Disabling VR in a specific scene (Oculus DK2) [SOLVED]

Discussion in 'VR' started by Spudly1701, Oct 28, 2016.

Thread Status:
Not open for further replies.
  1. Spudly1701

    Spudly1701

    Joined:
    Aug 25, 2013
    Posts:
    36
    Hi all,

    I'm wondering if anyone knows if it's possible to disable VR in a specific scene?

    What I have is an initial character creation scene (made up of UI elements), in which I want to use a static camera that the player completes on their monitor (It's a personal thing about not really liking UI's in VR). Once the character creation is completed there is another scene which tells the player to put on their headset and press a button on their controller, it then loads in the main game/experience scene.

    But with the Oculus SDK it seems to overwrite every camera in the project with the VR bits. So I'm hoping there's a solution. I've had a search around and I can't seem to find a solution that works. The most common solution I've found involves parenting the camera to an empty object and having that object essentially move in the opposite directions to the camera, essentially nullifying the movement, but that hasn't worked very well for me as the UI jitters all over the place, and the Cameras field of view gets screwy.

    Anyone have any solutions/ideas?

    Thanks
    Spud
     
  2. Spudly1701

    Spudly1701

    Joined:
    Aug 25, 2013
    Posts:
    36
    If anyone is interested, I figured out a way to do it. :)

    Create a Script on an empty GameObject in any scene that you want to disable VR and add the following in the Start()

    UnityEngine.VR.VRSettings.enabled = false;

    And in any scene to re-enable use....

    UnityEngine.VR.VRSettings.enabled = true;

    May not be the most elegant way of doing it, but it works, so I'm happy :)
     
    Ryuuguu and hicham_talib like this.
  3. adriansotov

    adriansotov

    Joined:
    Jul 14, 2015
    Posts:
    16
    Thanks!!!!!!
     
  4. HambaliJ

    HambaliJ

    Joined:
    Jul 10, 2017
    Posts:
    4
    Thank you for sharing the solution.
    Unity updated their VR/AR stuff.
    Now you need to use the following instead.

    Code (CSharp):
    1. UnityEngine.XR.XRSettings.enabled = true/false;
     
  5. roycefernandes3

    roycefernandes3

    Joined:
    Jan 21, 2019
    Posts:
    4
    Thanks!!!!!
     
  6. ComradeVanti

    ComradeVanti

    Joined:
    May 22, 2015
    Posts:
    25
    Last edited: Mar 13, 2023
Thread Status:
Not open for further replies.