going VR!

A tech blog for VR, Unity, and misc. about computer graphics

How to connect a Google VR (Daydream) controller emulator from non Android N devices (Android / iOS)


At Google I/O 2016, Google announced the release of Google VR (Daydream) that is a platform for high performance Virtual Reality apps extended from Google Cardboard. At the same time they also published Google VR SDK for Android, iOS, and of course Unity.


According to the setup guide, to fully test new functions of Daydream you need to prepare Google VR Ready device; which is only Nexus 6P now, and install Android N DP3 on it. But you can test the connection from your app to a controller on Unity Editor by using another android device in which an emulator app is installed.

Hack to use controllers from ALL devices

Use of controllers is one of new and major features of Google VR from Cardboard, and I guess every developers want to test this function.
But is a controller available only from Nexus 6P with Android N or Unity Editor? Do we need to purchase Nexus 6P just to test it? Actually the answer is No. By modifying SDK a little bit, you can use it from other types of Android without installing Android N and also iOS devices!!

Let's see how to hack the Google VR SDK for it.

1. Requirements

  • PC in which Unity is installed
  • an Android phone (to run a controller emulator app)
  • an Android or iOS device (to run your Google VR headset app)

First of all, setup Unity and Android/iOS development environment on your PC, and open a controller demo scene (follow instructions of the Daydream tutorial).

For the controller phone, install the controller emulator app from this apk file.

2. Setup Wifi

Turn on Wifi on controller and headset phones to connect them. In addition, there are two more choises: tethering or joining LAN. The detailed instructions are also described at the tutorial page. In either choise, check the IP address of the controller phone. If you run the controller emulator, you can see it around the top.


3. Change the connection setting

Now you are opening a controller demo scene on Unity.

In the hierarchy you can find a gameobject named GvrControllerMain with a GvrController componemt. Change emulatorConnectionMode to "wifi" (usb by default) in the inspector of the GvrController component.


4. Modify scripts

You have only to modify followed 2 scripts.

  • Assets/GoogleVR/Scripts/Controller/Internal/Emulator/EmulatorConfig.cs
    // IP address of the phone, when connected to the PC via WiFi.
    public static readonly string WIFI_SERVER_IP = "";//"";

The EmulatorConfig class has a static variable WIFI_SERVER_IP (on line 57). Change the string value of the IP address to that of your controller phone you checked on the above Step 2. If you are tethering by your controller phone, the IP address may be, so you do not have to modify here in that case.

  • Assets/GoogleVR/Scripts/Controller/Internal/ControllerProviderFactory.cs
      // Use the Controller Emulator.
      return new EmulatorControllerProvider(owner.emulatorConnectionMode, owner.enableGyro,
//#elif UNITY_ANDROID // Comment these 3 lines out. 
//      // Use the GVR C API.
//      return new AndroidNativeControllerProvider(owner.enableGyro, owner.enableAccel);

The other part is the #if directive on line 28 of ControllerProviderFactory.cs. By default Android apps use the native controller provider not the emulator provider. But as you know Daydream native functions are available only on Android N. So add " || UNITY_ANDROID || UNITY_IOS" to the first condition to also use the emulator provider on actual Android and iOS devices. Also comment #elsif directive to call the native controller provider.

5. Build and Run

The goal is almost there. Let's build and install the demo scene onto your headset phone, at first Android. In my case, I used two of Galaxy S6 (Android 6.0.1) for controller and headset.

Run the demo app, and run the controller emulator app on your controller phone. If success, the message on the top of the controller app should be "Connected!" from "Wainting for connection", and you can move the cursor in the headset demo app.

Google VR (Daydream) controller demo on Galaxy S6

Next, let's try iOS headsets. Again build the demo scene as an iOS project, compile and install it onto your iOS device by using Xcode. Here I used iPad mini with iOS 8.3 (of course iPhone is better for headsets... never mind). Finally it also works on my iPad mini!



By the above setup you can develop Google VR demos using controllers on your Android and iPhone devices without purchasing Nexus 6P. But you need to rebuild your headset app every time your controller phone's IP was changed because IP is hard coded. Additionally, this is just an ad-hoc and unofficial hacking, so it may be potentially prohibited on the future version of SDK.

Enjoy your daydream!