cancel
Showing results for 
Search instead for 
Did you mean: 

A question when support multiple VR Platforms on Unity

cdytoby
Explorer
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?
3 REPLIES 3

delphinius81
Rising Star
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? 

cdytoby
Explorer


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.

vrdaveb
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.