Search Unity

VR / 2D Launch options

Discussion in 'Daydream' started by oblorty, Nov 24, 2016.

  1. oblorty

    oblorty

    Joined:
    Oct 19, 2012
    Posts:
    10
    Is it possible to detect that my app was launched from inside the Daydream app ( library )?

    Because our app has 2D and VR scenes I would like to be able to use that information to direct the user to our VR scene at launch, and if they didn't open it from within the Daydream app then i could direct the user to our 2D scene at launch.
     
  2. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    271
    In the VR SDK list, add "None" as the first entry in the list, and Daydream as the second entry.

    When launched from the 2d launcher, your app will always launch in 2d mode.
    When launched from Daydream, your app will launch in VR mode.

    In your first scene you can check VRSettings.enabled, if it is false it means you are not in VR and you can load your 2d scene. If it's true, load your VR scene.
     
  3. zurrix

    zurrix

    Joined:
    Aug 6, 2014
    Posts:
    15
    Is there any way to launcher the app in 2d mode with Android Native Support?
    Say, the 2D mode of the APP is an android app compiled by Android Studio, and then if the app launch in Daydream,
    it will be a VR APP.
     
  4. paul_hayes

    paul_hayes

    Joined:
    Jul 3, 2012
    Posts:
    7
    I found this thread really useful. @thep3000 is this documented anywhere else? I couldn't find it plowing through both Unity and Google documentation of Daydream support.

    I was under the impression from the documentation that the X button in the top left when in VR mode would fire a Keycode.Escape down in the Input system, however it's causing my app to immediately close. I was hoping to catch this button press so I can use it to switch back to 2D mode as google does in the main Daydream app.

    I really appreciate any help you can give on this.
     
  5. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    544
    @zurrix Off the top of my head: Start with the None device as primary. When your scene loads, you should be able to ask the Java side for the current intent (I think that should be documented in our docs). If the intent has the Daydream launcher flag (check out the Google VR docs for that) then you can load the Daydream VR device. That being said, this would have the effect of starting the standard splash screen and not the VR splash screen which would probably fail app submission checks.

    @paul_hayes The X button is a known issue that should be fixed in the 5.6.1p2 release.
     
  6. paul_hayes

    paul_hayes

    Joined:
    Jul 3, 2012
    Posts:
    7
    Thanks @joejo that's good news.
     
  7. Markusn

    Markusn

    Joined:
    Jul 15, 2012
    Posts:
    17
    @joejo anything on the horizon regarding the splash screen problem? 2D and optional VR mode has worked wonders for Cardboard adoption and we try hard to make our app "just work" no matter what the scenario is:
    - start 2D from homescreen
    - switch to VR and back, Cardboard & Daydream depending on phone setup (it 'almost' works, GoogleVR supports that in theory but we have a hard time getting the DD controller to work when app doesn't start in VR)
    - start in VR when called from Daydream app

    It seems like both Google & Unity want to support this scenario, it feels like we are so close but it also seems hard to take that last step. Hope you have some good news.
     
  8. intruder_5

    intruder_5

    Joined:
    Mar 16, 2018
    Posts:
    3
    Did you find any fix for this?
    I am looking for similar button taking you back from VR to 2D.