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.

A question when support multiple VR Platforms on Unity

cdytobycdytoby Posts: 12
NerveGear
edited July 2016 in Unity Development
I'm working on a project on Unity, it requires the app for both Android and iOS, GearVR should also be supported. The libraries I used are: Oculus Utility for Unity and GoogleVR (Former CardboardVR), and what I want to do is: always using GoogleVR type camera, and disable all camera features and headtracks in GearVR, but GearVR platform availability should remains. That means, the app should be able to deployed on GearVR, but disable all features.

How to do that?
Tagged:

Comments

  • delphinius81delphinius81 Posts: 297
    Nexus 6
    You'll need to do some platform dependent checks to determine which features to turn on and off. You can do this using the UNITY_ANDROID and UNITY_IOS platform definitions.

    In a script that executes first thing somewhere in your initial scene, you should have something that runs on Start that does:

    #if UNITY_ANDROID
    // Configure your camera and platform code for GearVR
    #elif UNITY_IOS
    // Configure your camera and platform code for GoogleVR
    #endif

    You don't actually need to use the OVRCameraRig provided by the Oculus Utilities. For example, I use the default camera object and scripts provided by Unity for both GearVR and Rift builds because of native VR support.

    Now, for the second part of your questions, are you asking about building a GoogleVR app and deploying it through the GearVR store so that it will run on the GearVR device? 
  • cdytobycdytoby Posts: 12
    NerveGear
    You'll need to do some platform dependent checks to determine which features to turn on and off. You can do this using the UNITY_ANDROID and UNITY_IOS platform definitions.

    In a script that executes first thing somewhere in your initial scene, you should have something that runs on Start that does:

    #if UNITY_ANDROID
    // Configure your camera and platform code for GearVR
    #elif UNITY_IOS
    // Configure your camera and platform code for GoogleVR
    #endif

    You don't actually need to use the OVRCameraRig provided by the Oculus Utilities. For example, I use the default camera object and scripts provided by Unity for both GearVR and Rift builds because of native VR support.

    Now, for the second part of your questions, are you asking about building a GoogleVR app and deploying it through the GearVR store so that it will run on the GearVR device? 
    Thank you for the answer, but on Android we use GoogleVR too, but we need it also can be deployed on GearVR.

    The most ideal result is: there is a GearVR button, and the app runs normally on googlevr mode,
    and when press the button, a popup shows up, says put it into gearVR, and when I put it in gear, the app switch to gear mode.

    From what I searched, it's impossible for that in unity.

    So I'm thinking if the app can be deployed on GearVR, but disable all VR features, because it conflicts with GoogleVR, and I can't get the configuration right. It shows either 4 "images", or nothing at all, totally black screen with GoogleVR saperate line.
  • vrdavebvrdaveb Posts: 1,596 Oculus Staff
    always using GoogleVR type camera, and disable all camera features and headtracks in GearVR, but GearVR platform availability
    Unfortunately that won't work today because you need to include the Utilities to interact with the universal menu. See this guide for more details. Hopefully we can eventually enable that through Unity itself without requiring the Utilities, but I don't have a firm schedule for it. Also note that you will have to build a separate APK for Gear VR and non-VR because Gear requires vr_only in the manifest.
Sign In or Register to comment.