- Home /
Unity Daydream Technical Preview lacks controller support and crashes using Google VR SDK
I'm trying to develop a Google Daydream app with Controller support using the Unity Daydream Technical Preview build (UDTP). Unfortunately, UDTP does not appear to have native support for the Daydream controller, so I have no choice but to include the Google VR SDK to establish a connection.
The problem is whenever I attempt to build & run a Daydream app with Unity's 'Virtual Reality Support' enabled AND the Google VR SDK included, the app crashes at runtime. I presume that the plugins provided by the Google VR SDK are conflicting with UDTP's native VR support. I see that the app and the controller emulator establish a connection to eachother for a split-second, and then the app crashes.
I believe my best option might be to rebuild the Google VR SDK's plugin (libgvrunity) from source, removing all references to VR rendering and only keeping references to the controller, but the source for this plugin does not appear to be publicly available.
I'm going to try building a new plugin using the Google VR Android SDK, but if anybody else has faced this issue and can provide any support or direction, it would be greatly appreciated.
Answer by b4th · Oct 04, 2016 at 08:39 PM
I think I've now found a solution to the issue.
The GVR Android SDK (https://github.com/googlevr/gvr-android-sdk) contains an AAR file to link to the controller (libraries/controller/controller.aar). I was able to decompile this module in Android studio. The AAR module doesn't cover all of the controller's functionality (for instance, Accelerometer support), but they cover more than enough for our needs for this application. I wrote one little missing class in java (a listener), built this into an additional AAR module in Android Studio, and then loaded the two AAR files (controller.aar and controllerlistener.aar) into the Unity project. This gave me all I needed to create a few bridge classes in C# to allow Unity to talk to the java module classes to talk to the controller. Modify the GVR Unity SDK so that the ControllerProviderFactory creates the new AndroidJavaControllerProvider instead of the old AndroidNativeControlerProvider, et Voilá, the GvrControllerMain prefab works!
All the code I've written can be found at the following Gist:
https://gist.github.com/anonymous/ac8c76641f7b9b2608de50aae262644e#
And if you can really be bothered to jump through all these hoops, kudos!
Your answer
Follow this Question
Related Questions
Loading 8192x8192 textures at runtime on android 0 Answers
Many problems using the new Cardboard unity3D integration 0 Answers
[BUG] Can't use postprocessing with single-pass stereo rendering enabled (5.6, GearVR) 2 Answers
Google VR had a fatal issue while loading 3 Answers
Integrate VR scene made in unity into android studio 1 Answer