Hello devs, upon finding out that to use rewired input for Ouya I needed the ouya unity plugin, I had no other choice (I probably did) but to get the plugin working on the most recent version of unity that can build to Ouya. This version happens to be Unity 2019.2.21f1.
As some of you have noticed, the Ouya unity plugin makes the game crash as soon as you open it. Through some debugging with log cat, I was able to track down the moment the game crashes which is in the custom Activity inside OuyaUnityPlugin.jar(Assets/Plugins/Android/libs). To be honest I’m no java expert or have experience with native android code, but I was able to figure out from the unity docs that the way to create a custom entry Activity looks different from how the Ouya team did it(they create a new script that extends Activity, docs say to extend the included UnityPlayerActivity. Also I feel like it could be that unity changed their namespace in newer versions, I don’t really know).
Knowing this and after a couple attempts I finally arrived at the solution of creating a new Android Studio project and adding all the scripts from the plugin’s source code(thanks goodness the java source code is available on Ouya’s github) and modifying the MainActivity.java file to extend UnityPlayerActivity and removed some code that UnityPlayerActivity takes care of. Along the way I kept getting lots of errors from TurretMouseService.java about it using methods that require minimum api to be higher than level 16, so I messed with some of that code and Razer Turret Mouse might not work as expected. I was able to build the OuyaUnityPlugin.aar and replace the old jar file and… IT WORKED! My Ouya launched the game just fine.
The package for the updated plugin can be found here, and the source code that was forked from the ouya repo can be found here which includes that Android Studio Project. I’ve also removed some examples that had missing scripts and I updated some links on the OUYA Panel. There is an error that shows up in the console when opening the OUYA Panel but it can be dismissed and it shouldn’t keep you from building your game. All you need to do is go to the Player tab in Project Settings, add OpenGLES2 to the Graphics APIs list, change the Minimum API level to 16 and you are set to build your game to Ouya!
There are some features I’m planning to add to the plugin, like adding a custom Scripting Define Symbol to avoid typing the long #if UNITY_ANDROID && !UNITY_EDITOR all the time (and I think some people might want to still build to regular android without including Ouya code in their build), but this is good for now. Hope to see some more games on Discover soon!