cancel
Showing results for 
Search instead for 
Did you mean: 

How to switch between VR and non-VR mode, as in the "Samsung Gear 360" app, with Unity + Android?

ArthurFox
Honored Guest
Hi there, I'm developing a simple app in Unity and wish to be able to switch between starting in non-VR mode, then switching into VR mode. This is much in the same way as the Samsung Gear 360 app does when you click on the "View on Gear VR" button on the top-right. 

When enabling "Virtual Reality Supported" in the Android tab of the Unity Player Settings, the app will always require the Gear VR to start up, which is less than ideal. And once its running there's no way of switching out of VR, even when a script disables the suggested "VRSettings.enabled" flag, which simply doesn't seem to do anything.

So does anyone have any ideas?

Thanks in advance!
30 REPLIES 30

tej_pratap0
Honored Guest
Any Update?

Rob3342
Honored Guest
@imperativity , @vrdaveb , if the recommended solution is to have two APKs communicate, what's the recommended way to distribute these APKs? Does the oculus store support distributing and installing multiple APKs as part of a single "app" that the user would download from the store?

Thanks!

SuneVR
Explorer
Hi Oculus staff, where are we on the Dual Mode? @imperativity or @vrdaveb

SuneVR
Explorer
Hi Oculus staff, where are we on the Dual Mode? @imperativity or @vrdaveb

Slidely
Honored Guest
@imperativity
or
@vrdaveb
anything new regarding this issue?
please update us

Slidely
Honored Guest
@imperativity
Thanks for the update. Actually we need to switch to the non-VR mode just to grant the storage permissions and login with Facebook. Are there any other ways to achieve that?

zproxy
Expert Protege
Gear Vr Service lists Oculus Browser and Internet as DUAL

Can you, Oculus, produce documentation how they implement the dual mode?

Ilanb
Explorer
Hi,

This work fine for Cardboard (tested on unity 5.6.4p1), maybe change "Cardboard" to "Oculus", not tried yet...
Oculus team do you have some guidance ?

This code below only work on CardBoard (spacefrog)
public class VrToggle : MonoBehaviour
{
void Start()
{
StartCoroutine(LoadDevice("None"));
}

public void ToggleVR()
{
if (VRSettings.loadedDeviceName == "Cardboard")
{
StartCoroutine(LoadDevice("None"));
} else {
StartCoroutine(LoadDevice("Cardboard"));
}
}

IEnumerator LoadDevice(string newDevice)
{
VRSettings.LoadDeviceByName(newDevice);
yield return new WaitForEndOfFrame();
if (!VRSettings.loadedDeviceName.Equals(newDevice))
{
if(Constants.DEBUG)Debug.LogWarning("Waiting extra frame…");
yield return null;
}
VRSettings.enabled = true;
}
}


Anonymous
Not applicable
The code in the previous post certainly will not work, as GearVR at the moment  does not support this kind of dynamic switching. So i think it is better if you would remove your code snippet, as otherwise it simply would cause unnecessary  confusion on people looking in this thread  for help .




Ilanb
Explorer
Hi Spacefrog,

As I said, not tested on GearVR, my first words are, HOW to make this, like others posts in this thread...  
If it's supported a few month ago, why is not in documentation ?
"I have checked with the teams involved and support for this is a still a few months out."

Thanks,