Skip to main content
Participant
October 19, 2016

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

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!
This topic has been closed for replies.

30 replies

New Participant
July 17, 2017
@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!
Participant
October 17, 2017
Hi Oculus staff, where are we on the Dual Mode? @imperativity or @vrdaveb
Participant
October 17, 2017
Hi Oculus staff, where are we on the Dual Mode? @imperativity or @vrdaveb
New Participant
December 11, 2017
@imperativity
or
@vrdaveb
anything new regarding this issue?
please update us
New Participant
December 13, 2017
@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?
Up and Coming
December 15, 2017
Gear Vr Service lists Oculus Browser and Internet as DUAL

Can you, Oculus, produce documentation how they implement the dual mode?
HZ:VR viewtopic.php?f=77&t=22440
Participant
December 15, 2017
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;
}
}


December 15, 2017
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 .




Participant
December 15, 2017
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,

Up and Coming
December 15, 2017
unless there is documentation available, for DUAL has anyone reviewed the code for Oculus Browser and Internet  ?
HZ:VR viewtopic.php?f=77&t=22440