The OUYA SDK (ODK) pre-alpha preview was released last week, and I’ve been very anxious to tinker with it, especially to see how well it works with Unity3D, ever since backing the Kickstarter. There is a *.unitypackage file included in the ODK samples that has all the library *.jar files; some sample scenes, assets and scripts; SDK wrappers for Unity; an Editor panel script to hook the necessary libraries up; and Android application specific sources. The ODK seems to be more of a wrapper at this point, though many of the helper functions interface especially well with Unity3D, such as Input. It is quite extensive already for such an early release, which should be a welcome sign to those who backed it.

All things aside, I recommend reading the ODK Developer Documentation, running through the Setup section as well as the GitHub Documentation @ouya/docs. Most of the initial setup of application toolchains require a bit of tinkering before being able to delve in and create and test.

Personally, I had to install a different version of JDK, update my Android SDK (which I usually keep up-to-date), and the Android NDK. The versions I ended up using were:

  • Java JDK: jdk1.6.0_37
  • Android SDK: android-14
  • Android NDK: android-ndk-r8d

Loading up the provided package in Unity, the OUYA Panel editor tool provides several tabs that need to be pointed to required SDK version paths. If there are any missing dependencies (which show up greyed out) in any of these tabs, then you will need to download the proper version, point to the correct path, or compile them yourself.


Having said all that, I did run into a few snags getting it all up and running on a test device (Nexus 7) after importing the *.unitypackage.

Android NDK:

The first of which involved the Android NDK. Installing it is a breeze; it is just a *.zip file that needs to be unarchived and pointed to the proper location in the OUYA Panel. However, there is a known issue discussed in this Google Groups post that also includes a fix. Most places I’ve seen mention this fix believe it to only affect Mac, but I can confirm it was also necessary to compile with Windows 7.

To apply the fix, open and edit the {PATH_TO_NDK}/build/gmsl/__gmsl file, and find the line:

Replace with:

Build Settings:

This still did not compile, most likely to do with my Build Settings in my Unity project. In order to configure this correctly, the Bundle ID needs to match what is in the /Assets/Plugins/Android/AndroidManifest.xml (“package” identifier).

For example:

  • Bundle ID: com.domain.MyGame
  • Bundle Version: 1.0
  • Bundle Version Code: 1
  • Minimum API Level: Android 4.1 ‘Jelly Bean’ (API Level 16)
Build Warnings/Errors

The AndroidManifest.xml still seems to give some warnings, filed under errors in the console report, however I don’t think they will break an actual build mentioning the minimum SDK version set in the Build Settings.

Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion in ./AndroidManifest.xml

It seems no matter what is set in the Build Settings, or including the android:minSdkVersion with the same corresponding value this warning still reports. When selecting Build and Run via the Build Settings, I got several errors at certain points; one of which was:

[Building DEX Failed!] Failed to compiled Java code to DEX. See the Console for details.

There are several possible solutions to this:

  • Java version is not up-to-date (JDK 6 is best supported by Unity Android)
  • Set a Windows environment variable _JAVA_OPTIONS value: -Xmx512m
  • Unload, reload any *.jar dependencies in the project, some plugins seem to cause this
  • Re-import the OUYA *.unitypackage and load it on top of the existing one
  • The Bundle ID needs to be the same in Unity Build Settings, AndroidManifest.xml, and /Plugins/Android/src/


OUYA Controller Test

Finally, it built and ran on my Nexus 7. At this point however, there is no controller mapped to the Nexus 7 that the ODK recognizes. Fortunately, they ship the ODK with a “launcher” to pair a USB controller to the OUYA controller mappings.

Run these ADB commands with the device connected to install them to the device:

I have an Xbox USB controller and had to get a Mini USB OTG cable to connect the controller’s USB 2.0 port to Nexus’ Mini-USB. The Ouya docs recommend using the Xbox wired controller, and the InputListener method in OuyaGameObject reflects this in the switch statement. However, for my wireless controller, I had to add the following to the Xbox case statement:

Controller Issues

At this point, I got debug JSON output being reported, but functionality halted. The OuyaGameObject script that comes with the *.unitypackage is far from complete, it seems. There was some missing definitions in the KeyEvent and MotionEvent enums that need the following to operate properly (otherwise it fires off constant errors and halts further operations):

The OUYA Launcher begins with the controller pairing screen including intuitive instructions along with some optional Bluetooth settings if the controller is not recognized properly. An alternative to using a device such as a Nexus 7 would be to run the Android Virtual Device (AVD) with similar settings, also detailed in the Setup documentation.

OUYA Launcher: Controller Mapping

Finally, the OUYA Launcher menu has several options and list the games/apps that are recognized by the system that have been deployed to the device. It took a couple hours to get to this point, but now that the proper versions of SDKs are hooked up correctly to the OUYA Panel in Unity, I feel confident that this should be less painful in the future to work with. (Much like the first time I developed for iOS!)

OUYA Launcher: Menu

Helpful Links: