How to switch between VR and non-VR mode, as in the "Samsung Gear 360" app, with Unity + Android? — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

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

ArthurFoxArthurFox Posts: 7
NerveGear
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!

Comments

  • vrdavebvrdaveb Posts: 1,596 Oculus Staff
    Apps that support VR and non-VR modes today have to use separate APKs and send intents to each other.

    At some point, we plan to add support for "dual mode" in a single APK, but it will take changes in VRSVC that we can't expect to land within the next month or two. When dual mode works, you will be able to toggle it with VRSettings.enabled, but unfortunately it isn't clear when that will be.
  • ArthurFoxArthurFox Posts: 7
    NerveGear
    edited October 2016
    Ah i see, thanks for the response! Do you know of any tutorials or resources where I could learn how to this sort of thing?

    And also is there any sort of roadmap that I can keep up with to know when "Dual Mode" is being tackled and does indeed come through? Because if it were to say come through by January next year then that might not be a problem with the schedule I'm working towards.

    Thanks!
  • vrdavebvrdaveb Posts: 1,596 Oculus Staff
    > Do you know of any tutorials or resources where I could learn how to this sort of thing?

    Have a look at https://developer.android.com/training/sharing/send.html and http://answers.unity3d.com/questions/1040146/is-it-possible-to-open-a-unity-android-app-with-in.html.

    > is there any sort of roadmap that I can keep up with to know when "Dual Mode" is being tackled 

    Our engine integrations don't have a public roadmap, but dual mode should be working by the end of January.
  • ArthurFoxArthurFox Posts: 7
    NerveGear
    Great stuff - I look forward to getting the Dual Mode functionality!

    Thanks for the help @vrdaveb!

    =D
  • nehaObsessVRnehaObsessVR Posts: 1
    NerveGear
    Hi @vrdaveb, just wanted to check on whether the "Dual Mode" feature is available now. We are developing a similar Android app that needs to start in non-VR regular mode and then have the option to switch to VR mode with the Samsung Gear VR. Thank you!
  • vrdavebvrdaveb Posts: 1,596 Oculus Staff
    Unfortunately, dual mode is not on track for this month. Given the current priorities, it would be landing in March at the earliest.
  • VReelVReel Posts: 3
    NerveGear
    Same question here again =P
    Where are we on Dual Mode @vrdaveb ? =) 
  • VReelVReel Posts: 3
    NerveGear
    Hi guys, any updates?

    Thanks!
  • GamerPETGamerPET Posts: 1
    NerveGear
     :'( :'( 

    I'm also interested in this. Any updates?
  • tej.pratap0tej.pratap0 Posts: 1
    NerveGear
    Any Update?
  • Rob3342Rob3342 Posts: 1
    NerveGear
    @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!
  • SuneVRSuneVR Posts: 7
    NerveGear
  • SuneVRSuneVR Posts: 7
    NerveGear
  • SlidelySlidely Posts: 2
    NerveGear
    @imperativity
    or
    @vrdaveb
    anything new regarding this issue?
    please update us
  • SlidelySlidely Posts: 2
    NerveGear
    @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?
  • zproxyzproxy Posts: 245
    Art3mis
    Gear Vr Service lists Oculus Browser and Internet as DUAL

    Can you, Oculus, produce documentation how they implement the dual mode?
  • IlanbIlanb Posts: 5
    NerveGear
    edited December 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; } }

  • spacefrogspacefrog Posts: 50
    Hiro Protagonist
    edited December 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 .




  • IlanbIlanb Posts: 5
    NerveGear
    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,

  • zproxyzproxy Posts: 245
    Art3mis
    unless there is documentation available, for DUAL has anyone reviewed the code for Oculus Browser and Internet  ?
  • zproxyzproxy Posts: 245
    Art3mis
    (name = "com.samsung.android.vr.application.mode", value = "dual")
    on S6, if apk is set for dual, it does appear under DUAL list near others. If clicked, it seems its primary activity is launched.

    will the app then have to await for the headset event, and then launch itself again? or will oculus home block it while inside headset?
  • zproxyzproxy Posts: 245
    Art3mis
    why is Oculus Browser browser listed as DUAL? when clicked, it asks for Gear VR like other 
    vr_only
    apps?
  • StaRky_FRStaRky_FR Posts: 4
    NerveGear
    @imperativity
    Hi ! Any update for the dual functionnality ?
    Is there a workaroud ?
  • SuneVRSuneVR Posts: 7
    NerveGear
  • iBrewsiBrews Posts: 2
    NerveGear
    bump! Would really appreciate this, or at least knowing when it can be expected.
  • behnam-lumbehnam-lum Posts: 3
    NerveGear
    Still waiting for this and nothing happens!
Sign In or Register to comment.