GoogleVR - Cardboard + Android build error

Using the GoogleVR SDK, I have created a very basic scene in Unity, involving a ‘recticle’ that changes the color of a cube when the user hovers over it. This works completely as expected in play mode, however, when I build it to android and run it on my device (Motorola G4 - Android 7.0) I observed some strange behavior. Usually, the recticle would expand when it is over the cube but, on my device, this doesn’t happen and instead it works when the recticle is offset to the left of the cube. Why is this happening?

The only thing that I have changed that could’ve possibly caused this is deleting the /Assets/Plugins/Android folder as I had to do this to enable to project to build because Unity was “unable to convert classes into dex format”, meaning that multiple classes with the same name existed. (I’m not sure why and I couldn’t find any other matching classes, but deleting the folder seemed to fix the issue)

Thanks in advance,

  • Callum

Are you using Unity 5.6? If yes, your problem can be the native compatibility with Google Cardboard implemented in Unity 5.6.

If you downloaded Cardboard SDK from Quickstart for Google VR SDK for Unity with Android  |  Google for Developers and you’re using Unity 5.6 version, then this “strange behavior” you talk may be just some conflicts between the Unity’s Cardboard Native Support and the Google’s External SDK.

This happens because when you play your game in Editor Mode, you’re playing in PC plataform, which ISN’T affected by Unity’s Cardboard Native Support — here only Google’s External SDK is working. And when you build your app for Android and play the game on your Smartphone, you’re playing on Android’s plataform, which IS affected by native support and by Google’s External SDK at the same time, what could generate some those strange behaviours when you port the game for android.

So here are the facts:

Since my case is similar to yours, but I’m not facing any problem, I’ll give you some idea of my hierarchy (Android/Cardboard). With Virtual Reality Supported enabled and Cardboard listed in the Player Settings, I have the following Gvr objects in my scene:

GvrViewerMain: with the ‘GvrViewer’ script.

GvrReticlePointer: as a child of my 'Main Camera , with the ‘GvrReticlePointer’ script.

EventSystem: with GvrPointerManager and GvrPointerInputModule scripts. Remember to Disable the Standalone Input Module here.