I spent a few days setting up all my tools to get everything working for a fluid workflow from developing games to building them and installing them on my OUYA wirelessly from across the room. So, instead of having to go through what I did, here is a step by step guide to developing OUYA apps with Unity! It is a bit overwhelming, but if you just follow the steps, you should be fine. Oh, and expect it to take a while. I don’t recommend doing all of this in one sitting.
Also, there is quite a lot here, which I imagine can change over time. If you find any errors, please let me know in the comments, so I can update this post. Thanks!
Please also look at the official OUYA Unity documentation!
- 1 Extract ODK
- 2 Setup your project
- 3 Switch to Android platform
- 4 More build settings (in Inspector panel)
- 5 Import packages
- 6 Compile stuff in OUYA panel
- 7 OUYA icon
- 8 File Management
- 9 Make Unity coding less annoying
- 10 Develop your app
- 11 Prepare app for Discover Store
Open the ODK
- Download and install Unity.
- Clone or download unity-odk-plugin. Click [Download zip] on that page to download.
- Now open this project in Unity by clicking through the top menu in Unity: File > New Project.
- Click Open Project tab and then [Open Other...].
Note that Unity projects are not opened by choosing a specific file as in other systems! So, find the folder where you saved the plugin and click [Open]. Note that Unity projects are just the folder where they are located, so you just need to point Unity to that folder.
Export ODK Unity packages
Now that you have the ODK Unity project open in Unity, click through the top Unity menu:
- OUYA > Export Core Package
- OUYA > Export Examples Package
- OUYA > Export StarterKit Package
Setup your project
Create new project
- Click through the Unity menu: File > New Project…
- Make sure the New Project tab is active.
- Choose your project directory.
- Click [Create Project].
Configure assets for sane version control
Set assets to force text to make version control easier: Edit > Project Settings > Editor. Now set the following parameters.
- Version Control Mode: Meta Files
- Asset Serialization Mode: Force Text
Did you get an error that you can’t perform this action, because you don’t have the PRO license? Upgrade to Unity 4.2 or later and it will work!
Switch to Android platform
- Unity menu: File > Build settings.
- Select Android.
- Click [Switch Platform].
- Click [Player Settings] which will then open the player settings in the Inspector panel.
More build settings (in Inspector panel)
Cross Platform Settings
- Enter your company name.
- Enter your product name.
- Click the Android tab.
Resolution and Presentation
Default Orientation: Landscape Left
Ignore this tab, because OUYA has special icon treatment, see icon section below.
If you don’t have Unity PRO, your splash screen will be Unity’s default screen. If you do have PRO, put your splash screen here.
Minimum API Level: Android 4.1 ‘Jelly Bean’ (API level 16)
Ignore this tab, because you want to make debug builds now.
Now, you can either import the Core Package, which you have previously exported from the Unity ODK, by double-clicking on it in your file browser or you can click through the Unity menu: Assets > Import Package > Custom Package…
If at any point after importing an OUYA package there are errors, you most likely need the NGUI package. Either buy it (it’s definitely worth it) or import the free one included with the ouya-unity-plugin (in the directory: Assets/NGUI. Note that you can import Unity packages either by double clicking on the package in your file browser (outside of Unity) or by using the Unity menu: Import Package > Custom Package.
- Optional: import StarterKit package
- Optional: import Examples package
- Optional: import NGUI from the Asset Store (Unity menu: Window > Asset Store) or ODK Unity
Now open the OUYA Panel using the Unity menu: Window > Open OUYA Panel.
Compile stuff in OUYA panel
Java JDK tab
Download the Java JDK. Now install it and choose the JDK Path after clicking on [Select SDK Path...]. Make sure all lines on this tab are not grayed out and continue.
Android SDK tab
Now return to the OUYA panel in Unity and click [Select SDK Path...] and choose where you put the SDK. At this point, nothing should be grayed out in this tab anymore. If the APT Path is still grayed out, go into the SDK directories and find the APT file and copy it into the platform-tools directory. Now you should go back to the OUYA panel SDK tab and nothing else should be grayed out. Yes, this is weird, but it works. Go figure.
Optional: Android NDK tab
[StoicHamster says that this step is unnecessary unless you are linking C/C++ native code or libraries. So, that means most developers won't need to do this step.]
Still with me? Ok, want to download something else? Alright, go download the Android NDK. Important: be sure to install it in the root directory of your hard drive! If the NDK is not in the root directory, it will not work! Next, return to the Android NDK tab in the OUYA panel and Select the NDK Path and the NDK Make Path. At this point, make sure these lines are no longer grayed out. When this is true, you can move on to the Android SDK tab!
You hopefully don’t need to look here, but just make sure nothing is grayed out. If something is grayed out, scream at the top of your lungs and punch the nearest wall. Sorry, I can’t help you here.
Finally, we’re about ready to compile the whole shebang.
- Enter your bundle ID in OUYA tab, then click [Sync Bundle ID].
- Click [Compile NDK].
- Click [Compile Plugin].
- Click [Compile Java].
Now go get a cup of coffee and be happy you finished all that. You’re now ready to start working on your project! The rest of the instructions relate to how to best build your project when you’re ready to test it on your OUYA.
To be able to see your app well, make yourself a horrible looking 732×412 png file. Why 732×412? They wanted to confuse graphic designers all around the world. Go find a post-it note somewhere and write 732×412 on it and stick it somewhere you’ll always see it. You’ll thank me later.
Oh, got that icon? Find your Project tab and drill down into Plugins/Android/res/drawable-xhdpi. Now replace the ouya_icon.png there with yours. Voila ! You’ve got icon!
You really thought you could transfer files to your OUYA using a USB stick?! You really don’t want to go down this road. Trust me.
While not necessary, it’s so easy, you might as well install it. Search the Discover store on your OUYA for FilePwn and install it. Now you can cruise around your file system to orient yourself.
Now for something cooler! From your computer set up an AirDroid account on www.airdroid.com. You don’t want to register for an account? Do it anyway. It’ll save you loads of time in the future. Believe me, it’s awesome. Really!
Go to your OUYA and sideload AirDroid by running the web browser in the Make/Software screen. Painstakingly type the following into the web address: www.airdroid.com/invite/airdroid_v2.apk Next, install and open the app. Back out of its first screen, so it can auto-update. Then, login and marvel at how awesome it is. Now you can easily interact with your OUYA from the comfort of your plush computer seat. Install APK files. Look at all your apps. Move files and folders around. It’s so nice… oouu yaaa!
Wireless ADB (Android Debug Bridge)
Go through the main menu to Manage > System > Development and set ADB OVER NETWORK to ON.
Now go to your terminal and type “adb connect ip-address” (change “ip-address” to your OUYA’s IP address).
If you’ve completed everything correctly, you should be able to go back to Unity and press Ctrl+B (Cmd+B on Mac) and it will compile, transfer the build to your OUYA wirelessly and start running it. Having a single command to do all this will make your life so much easier when you’re tweaking little things in your game later. Yay!
What? It’s under Play with all your other games and apps. Yep, it is. The Builds/Make folder are for the apps you’ve uploaded in the OUYA Games page.
Also, you can now look at logcat. Type “monitor” in the Terminal and you should get lots of goodies to look at your OUYA. Open the Logcat tab to see all the output from your OUYA’s activity. Also, if you click on the camera icon, you can make a screenshot of your TV, which you will later need for the Discover Store.
Make Unity coding less annoying
C# code formatting
- Open the MonoDevelop-Unity app.
- Go to Settings and then find Source Code > Code Formatting.
- Choose the C#-format tab, then click Edit.
- Here you can change the code formatting to the conventions you want. I, at least, find the defaults incredibly annoying.
To avoid headaches, use this special controller package. You should now have an easy way to interface with the controller which will work with all the common controllers attached to your computer and to your OUYA. Magic. Likely most of these changes will be included in the standard ODK controller interface eventually. Until then, be happy with this alternative.
[I personally recommend git, but Mercurial seems like a good choice as well.]
You want to play around a bit developing your prototype without a repository under you? Not a good idea. Running a repository will let you undo changes whenever you mess up. And at some point, you will definitely mess up. We’re all human after all.
Git is cool, because it’s widely supported and doesn’t require an external server to run. If you’re not familiar, here’s how to set up a Git repository. If you’re a newbie, you’ll probably want to get a user-friendly app to interface with it. I personally prefer Tower on the Mac, but if you want to save money, you can go with the free SourceTree, which is also respectable, but not nearly as nice in my opinion.
Develop your app
I’m afraid I can’t help you too much with this step, but if you run into trouble, the people on the OUYA Developer Forums are really nice.
Prepare app for Discover Store
Everything here should be pretty self-explanatory. The only issue you might have is what to call your Bundle ID. Make sure it starts with the end of your webdomain. Thus, my app bundles should start with de.chucksmith unless I have a very, very good reason not to do this.
First, you need to sign your app. Follow the instructions at android.com.
To create a key pair, run the following command and then answer the questions that come to you in the Terminal:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
If you are ever working on a non-Unity project and building with ant, also add the following lines in your ant.properties file:
Now when you upload your apk file to devs.ouya.tv, your game will show up under Makes/Builds on your console.
Well, that should be everything. Now, take a break (you deserve it) and go make an awesome game!