I've downloaded the sdk yesterday. I'll skip the bitching and cursing about the documentation since it's my first post and go to the subject.
I'm trying to get input using the standard way of Unity: Input.GetAxis and so on. I don't want to go around changing all my code just because I've got an OUYA.
If you want to use the standard Unity input, you have to change OuyaUnityApplication.java... so I did to no avail:
Crash. The logcat gives this:
D/AndroidRuntime( 2209): Shutting down VM
W/dalvikvm( 2209): threadid=1: thread exiting with uncaught exception (group=0x4
1c43300)
E/AndroidRuntime( 2209): FATAL EXCEPTION: main
E/AndroidRuntime( 2209): java.lang.Error: FATAL EXCEPTION [main]
E/AndroidRuntime( 2209): Unity version : 4.2.0f2
E/AndroidRuntime( 2209): Device model : OUYA OUYA Console
E/AndroidRuntime( 2209): Device fingerprint: OUYA/ouya_1_1/ouya_1_1:4.1.2/JZO54L
-OUYA/346:user/test-keys
E/AndroidRuntime( 2209):
E/AndroidRuntime( 2209): Caused by: java.lang.RuntimeException: Unable to resume
activity {com.bocazas.dogfight/com.bocazas.dogfight.OuyaUnityApplication}: java
.lang.NullPointerException
E/AndroidRuntime( 2209): at android.app.ActivityThread.performResumeActiv
ity(ActivityThread.java:2575)
E/AndroidRuntime( 2209): at android.app.ActivityThread.handleResumeActivi
ty(ActivityThread.java:2603)
E/AndroidRuntime( 2209): at android.app.ActivityThread.handleLaunchActivi
ty(ActivityThread.java:2089)
E/AndroidRuntime( 2209): at android.app.ActivityThread.access$600(Activit
yThread.java:130)
E/AndroidRuntime( 2209): at android.app.ActivityThread$H.handleMessage(Ac
tivityThread.java:1195)
E/AndroidRuntime( 2209): at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime( 2209): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2209): at android.app.ActivityThread.main(ActivityThrea
d.java:4745)
E/AndroidRuntime( 2209): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 2209): at java.lang.reflect.Method.invoke(Method.java:5
11)
E/AndroidRuntime( 2209): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 2209): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:553)
E/AndroidRuntime( 2209): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2209): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 2209): at com.bocazas.dogfight.OuyaUnityApplication.onR
esume(OuyaUnityApplication.java:277)
E/AndroidRuntime( 2209): at android.app.Instrumentation.callActivityOnRes
ume(Instrumentation.java:1184)
E/AndroidRuntime( 2209): at android.app.Activity.performResume(Activity.j
ava:5095)
E/AndroidRuntime( 2209): at android.app.ActivityThread.performResumeActiv
ity(ActivityThread.java:2565)
E/AndroidRuntime( 2209): ... 12 more
Comments
That's all there is to it. Not sure about all the stuff you're talking about. And there shouldn't be any Java changes required. Did you just get the base Java ODK instead of the Unity Ouya C# plugin? The plugin takes care of all that nasty stuff for you.
You can also use the OuyaExampleCommon script to handle Input as well. It will take care of button mappings for different controllers if you want to support PS3 controllers, for example.
Take some time and learn Designer-Friendly Programming 101.
OUYA Inc | Android Developer
Skype: tgraupmann_prey
http://github.com/ouya/docs
http://github.com/ouya/ouya-sdk-examples
Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]
Use caution when setting [persistent wireless mode].
OUYA Inc | Android Developer
Skype: tgraupmann_prey
http://github.com/ouya/docs
http://github.com/ouya/ouya-sdk-examples
Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]
Use caution when setting [persistent wireless mode].
I didn't even check out the GIT repo, just downloaded it as a ZIP and opened the project in Unity. Then, after getting the proper things installed and located (such as JDK and proper platforms of the Android SDK), you can go to the OUYA panel window and hit "Export Core Package".
Bam. Now you have a UnityPackage.
To use Unity Input, just uncheck the Use Legacy Input checkbox.
I've tested it, and it works flawlessly.
I'll admit that having to create an extra Unity project just to generate the Unity package needed to import into your actual project is a little odd. Ideally, devs would be able to just download the *.unitypackage file rather than generating it themselves.
Other than that little weirdness, the plugin has worked great for me. Just like Killa_Maaki said, import the package, uncheck the box. Done!
Is it a bit confusing? Maybe. Is the documentation perfect? No. Is it impossible? Hardly.
Take some time and learn Designer-Friendly Programming 101.
OUYA Inc | Android Developer
Skype: tgraupmann_prey
http://github.com/ouya/docs
http://github.com/ouya/ouya-sdk-examples
Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]
Use caution when setting [persistent wireless mode].
OUYA Inc | Android Developer
Skype: tgraupmann_prey
http://github.com/ouya/docs
http://github.com/ouya/ouya-sdk-examples
Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]
Use caution when setting [persistent wireless mode].
OUYA Inc | Android Developer
Skype: tgraupmann_prey
http://github.com/ouya/docs
http://github.com/ouya/ouya-sdk-examples
Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]
Use caution when setting [persistent wireless mode].
Works flawlessly and is very simple and easy to use and works with xbox and ps3 controllers.
OUYA Inc | Android Developer
Skype: tgraupmann_prey
http://github.com/ouya/docs
http://github.com/ouya/ouya-sdk-examples
Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]
Use caution when setting [persistent wireless mode].
OUYA Inc | Android Developer
Skype: tgraupmann_prey
http://github.com/ouya/docs
http://github.com/ouya/ouya-sdk-examples
Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]
Use caution when setting [persistent wireless mode].