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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to remove VR Split Screen when App starts. Unity 5.6

Discussion in 'Android' started by marpione, May 14, 2017.

  1. marpione

    marpione

    Joined:
    Apr 16, 2016
    Posts:
    26
    Hello everyone. I'm making an App in Unity that has VR/AR and non vr scenes. I can enable and disable the VR inside the app by using VRSettings.LoadDeviceByName however when the app starts before unity Splash screen app shows a split screen. PlayerSetting => Virtual Reality supported is checked of course when I uncheck it VR is not working as you can imagine. I'm calling VRSettings.LoadDeviceByName in an IEnumerator in the Awake Funtion. If you want I can upload the APK to a link.

    Is there a way to remove the split screen at start?
     
  2. crypt0

    crypt0

    Joined:
    May 25, 2015
    Posts:
    55
    Hi,
    you have to choose None as the first device in the PlayerSettings Virtual Reality SDKs
    Device None is equivalent to a non-VR application.
    Built applications: Choosing startup device

    But in my application it doesn't work - If I set None as first device and then I switch ingame to VR, I got a very strange result...

    Cheers
     
  3. marpione

    marpione

    Joined:
    Apr 16, 2016
    Posts:
    26
    No I haven't tried that let me try and get back to you thanks for the advice.
     
  4. marpione

    marpione

    Joined:
    Apr 16, 2016
    Posts:
    26
    Hi crpt(). Thanks for your answer I finally figured out how to remove it thanks to you. As you mentioned I select the device type to none but then GoogleVR didn't work at all but later I added the Cardboard sdk as an second SDK and worked like a charm. Here see the picture on how I manage the Player settings.

    Also this is the code I'm using to enable and disable the VR.

    Hope this will help people.

    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEngine.VR;
    6. public class VRSceneManager : MonoBehaviour {
    7.  
    8.     public static VRSceneManager instance;
    9.  
    10.     void Awake()
    11.     {
    12.         enableVr();
    13.         //or
    14.         //disableVR();
    15.     }
    16.  
    17.     // Use this for initialization
    18.     void Start()
    19.     {
    20.         instance = this;
    21.     }
    22.  
    23.     IEnumerator LoadDevice(string newDevice, bool enable)
    24.     {
    25.         VRSettings.LoadDeviceByName(newDevice);
    26.         yield return null;
    27.         VRSettings.enabled = enable;
    28.     }
    29.  
    30.     void enableVr()
    31.     {
    32.         StartCoroutine(LoadDevice("cardboard", true));
    33.     }
    34.  
    35.     void disableVr()
    36.     {
    37.         StartCoroutine(LoadDevice("", false));
    38.     }
    39. }
     

    Attached Files: