Author Topic: UIKeyNavigation not working with controller  (Read 3903 times)

rvm8i

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 3
    • View Profile
UIKeyNavigation not working with controller
« on: February 09, 2015, 11:14:24 PM »
Hi,

I'm trying to get the UIKeyNavigation script to work with a controller. When I run the example script for controller and keyboard input for this, it doesn't respond to input from either of the analogue sticks or the directional pad; only keyboard input causes the selection to change. I put Debug.Log statements inside the OnKey method to see if it's processing the input properly, but it appears as though only the A and B buttons have any effect (A selected the button as if I had pressed Enter, but didn't print, while B printed 'Escape'). I've tried both an Xbox 360 controller and an Xbox One controller, with exactly the same result. I even reset my project's input settings to the default settings, and it still doesn't work.

I'm really stumped by this issue... Any help would be much appreciated :)

Thanks,

rvm8i

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIKeyNavigation not working with controller
« Reply #1 on: February 10, 2015, 05:22:50 AM »
1. You need to make sure you have Controller events enabled on UICamera.
2. You need to set up the axes in project's input settings. Horizontal and Vertical are used by default.
3. NGUI doesn't listen to keys. NGUI listens to axes. After you set them up as per #2, make sure UICamera actually uses them. By default it will use Horizontal and Vertical.