(For more resources related to this topic, see here.)
Starting with the OUYA Development Kit
The OUYA Development Kit (OUYA ODK) is a tool to create games and applications for the OUYA console, and its extensions and libraries are in the .jar format. It is released under Apache License Version 2.0.
The OUYA ODK contains the following folders:
Licenses: The SDK games and applications depend on various open source libraries. This folder contains all the necessary authorizations for the successful compilation and publication of the project in the OUYA console or testing in the emulator.
Samples: This folder has some scene examples, which help to show users how to use the Standard Development Kit.
Javadoc: This folder contains the documentation of Java classes, methods, and libraries.
Libs: This folder contains the .jar files for the OUYA Java classes and their dependencies for the development of applications for the OUYA console.
OUYA Framework APK file: This file contains the core of the OUYA software environment that allows visualization of a project based on the environment of OUYA.
OUYA Launcher APK file: This file contains the OUYA launcher that displays the generated .apk file.
The ODK plugin within Unity3D
Download the Unity3D plugin for OUYA. In the developer portal, you will find these resources at https://github.com/ouya/ouya-unity-plugin.
After downloading the ODK plugin, unzip the file in the desktop and import the ODK plugin for the Unity3D folder in the interface engine of the Assets folder; you will find several folders in it, including the following ones:
Ouya: This folder contains the Examples, SDK, and StarterKit folders
LitJson: This folder contains libraries that are important for compilation
Plugins: This folder contains the Android folder, which is required for mobile projects
“The Last Maya” created with the .ngui extension
Importing the ODK plugin within Unity3D
The OUYA Unity plugin can be imported into the Unity IDE. Navigate to Assets | Import Package | Custom Package…. Find the Ouya Unity Plugin folder on the desktop and import all the files. The package is divided into Core and Examples. The Core folder contains the OUYA panel and all the code for the construction of a project for the console. The Core and Examples folders can be used as individual packages and exported from the menu, as shown in the following screenshot:
Installing and configuring the ODK plugin
First, execute the Unity3D application and navigate to File | Open Project and then select the folder where you need to put the OUYA Unity plugin.
You can check if Ouya Unity Plugin has been successfully imported by having a look at the window menu at the top of Unity3D, where the toolbars are located. In this manner, you can review the various components of the OUYA panel.
While loading the OUYA panel, a window will be displayed with the following sections and buttons:
Build Application: This is the first button and is used to compile, build, and create an Android Application Package file (APK)
Build and Run Application: This is the next button and allows you to compile the application, generate an APK, and then run it on the emulator or publish directly to a device connected to the computer
Compile: This button compiles the entire solution
The lower section displays the paths of different libraries. Before it uses the OUYA plugin, the user ought to edit the fields in the PlayerSettings window (specifically the Bundle Identifier field), set the Minimum API Level field to API level 16, and set the Default Orientation field to Landscape Left. Another button that is mandatory is Bundle Identifier synchronizer, which synchronizes the Android manifest file (XML) and the identifiers of Java packages.
Remember that the package ID must be unique for each game and has to be edited to avoid synchronization problems.
Also, the OuyaGameObject (shown in the following screenshot) is very important for use in in-app purchases:
The OUYA panel
The Unity tab in the OUYA panel shows the path of the Unity JAR file, which houses the file’s JAR class. This file is important because it is the one that communicates with the Unity Web Player. This Unity tab is shown in the following screenshot:
The Java JDK tab shows the routes of the Java Runtime installation with all its different components to properly compile a project for Android and OUYA, as shown in the following screenshot:
The Android SDK tab displays the current version of the SDK and contains the paths of the different components of the SDK: Android Jar Path ADB, APT SDK Path, and Path, as shown in the following screenshot. These paths must correspond to the PATH environment variable of the operating system.
Finally, the last tab of the OUYA panel, Android NDK, shows the installation path of C++ scripts for native builds, as shown in the following screenshot:
Installing and configuring the Java class
If at this point you want to perform native development using the NDK or have problems opening or compiling the OUYA project, you need to configure the Java files.
To install and configure the Java class, perform the following steps:
Download and install the JDK 1.6 and configure the Java Runtime path in the PATH environment variable.
Next, you need to set a unique bundle, identifier.com.yourcompany.gametitle.
Hit the Sync button so your packages and manifest match.
Create a game in the developer portal that uses the bundle ID. Download that signing key (key.der) and save it in Unity.
Compile the Java plugin and the Java application.
Input your developer UUID from the developer portal into the OuyaGameObject in the scene.