Author Topic: OUYA Button Support via new UIButtonKeys  (Read 2031 times)


  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 13
    • View Profile
OUYA Button Support via new UIButtonKeys
« on: January 29, 2013, 06:47:53 AM »
There've been a few posts here and there about people developing for the OUYA. As-is, NGUI's built-in UIButtonKeys will not work on the console itself because the OUYA SDK's input doesn't go through Unity's input. So, with that in mind, I re-wrote the UIButtonKeys class to work on the dev console.

Get it here! OuyaUIButtonKeys.cs

Note: You will also need to change UICamera.cs. (For an explanation, see this thread) Under UICamera.Awake(), it checks the current platform, and will disable some input options, which will mess up button selection. You can just comment out the Android check, like so, and it will work:
  1. if (//Application.platform == RuntimePlatform.Android ||
  2.         Application.platform == RuntimePlatform.IPhonePlayer)
  3. {
  4.         useMouse = false;
  5.         useTouch = true;
  6.         useKeyboard = false;
  7.         useController = false;
  8. }

It could potentially be cleaner to do all of the input changes in UICamera.cs itself; however, keeping the input handling entirely in a separate script will make it a lot easier to merge in new versions.


  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,140
  • Toronto, Canada
    • View Profile
Re: OUYA Button Support via new UIButtonKeys
« Reply #1 on: January 29, 2013, 05:50:11 PM »
UICamera has "onCustomInput" delegate you can tie into for your OUYA event processing.

I'll remove the force-setting of keyboard and controller settings for Android as well, so you won't need to modify UICamera.


  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: OUYA Button Support via new UIButtonKeys
« Reply #2 on: September 16, 2014, 06:57:57 PM »
Not sure if any changes were made to handle this, but I had to comment out the Android override for the mouse handler to get the Ouya Touchpad working. This is because the ProcessMouse() happens prior to the onCustomInput call.