I’m trying to support both Daydream/GearVR, and so I want a build pre-process step that reads from the PlayerSettings/OtherSettings which VR SDK is being targeted, and then destroys/enables certain game objects with the platform-specific scripts.
Also, when I target two VR sdks (Oculus and Daydream) and then build for Android, my Google Pixel automatically prompts for the Daydream headset when launching the app. If I were to run the app on a Samsung phone, would it prompt for the gear VR instead? I don’t have a Samsung phone yet, but I’ll be buying an s8 soon, so trying to prepare for multiplatform support now.
I wasn’t sure whether adding Daydream to the target list results in always prompting for the Daydream on Android, or only if the device supports Daydream. Hence my attempt at a build preprocess step, and maintaining two separate Android builds for Daydream and GearVR. Hoping you could shed some light on this!
The order in which you have the SDKs in the player settingslist are the order in which the engine attempts to initialize them. So if you put Daydream first and then Oculus, we’ll first try to use Daydream. If the device doesn’t support it then we’ll continue to the next SDK on the list, in this case using Oculus. So yes, it should work as you’re guessing.
I have a product that will be on the store soon that will do this automatically as well as adding the appropriate OVRmanager or GVRcontroller and GVRarmmodel respectively via a menu dropdown for “build daydream” or “build gear vr”.
In general though your best bet is to write an editor script to actually add the one you are building for and removing the one you aren’t currently building for from the list. It’s not like there aren’t other things that need to be different, I haven’t seen an apk yet that can just be uploaded to both stores without modifications (controller api is different, camera rigs are different,etc.). That way at runtime you can do a nice check at points at which one is being used. Also, its best to make sure the manifests are correct if you are publishing since the two platforms have different requirements. In the end this definitely can be done.