Author Topic: UICamera Input problem (affecting key navigation)  (Read 8305 times)

meganuke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 33
    • View Profile
UICamera Input problem (affecting key navigation)
« on: March 02, 2017, 09:31:53 PM »
Well after days looking,
searching on google and this forum

reading people with the same problem, and no one ever saying "its fixed".
even downloading the latest version
i decided to try to fix this issue myself.

its very simple, i add "key navigation" to some buttons, but it doesnt work correctly in the Android microconsole. nor with keyboard strokes.
so i tried a windows version, and it doesnt work either.

so i created a new scene, a new project, created 2 buttons, added 2 key navigations.... and it doesnt works either!!!. :(
so i disabled input by mouse and touch...
and still doesnt work.

then i noticed the small "debug" checkbox, and checked it.

run the program
the debug info reads: "Scheme: Touch"

press "up key"
and the debug info reads: "Scheme: Mouse"

and i can see in the UICamera script line: 1942 method: ProcessEvents (), that events are processed only for the specific input
so.... it seems to me like this a NGUI problem...


right now im working around the issue with 

UICamera.controllerNavigationObject = Buttons[selectedbutton];


but it would be nice if you fix this.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #1 on: March 06, 2017, 05:12:52 PM »
Simply turn off the mouse input checkbox on your UICamera and it won't be switching to the mouse scheme.

meganuke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 33
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #2 on: March 06, 2017, 09:43:29 PM »
...
so i disabled input by mouse and touch...
and still doesnt work.
...

please read the whole post

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #3 on: March 10, 2017, 11:05:26 AM »
Alright sorry then I don't understand the issue you're describing. What's the problem exactly? Key-based navigation is not working? The controller input example that comes with NGUI lets you interact with UI using arrow keys just fine. How can I reproduce the issue on my end to understand what you mean?

meganuke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 33
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #4 on: March 10, 2017, 11:42:28 PM »
ok, sorry for not being clear.

i read your comment and went straight to test the input controller screen and... it didnt work!!!

i recorded a video to see if i can explain better:

https://youtu.be/RY1enBZ9shY

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #5 on: March 15, 2017, 01:12:08 PM »
That's odd, it works just fine on my end -- latest version of NGUI and Unity. And you said you created a brand-new project as well... By default Unity assigns arrow keys and joystick axes to the same input axes (Horizontal and Vertical) -- can you double check to ensure that's the case? Check Unity's Input properties. There is also no need to uncheck mouse / touch for that example. It should work without any modifications. When you start with mouse/touch enabled, the button won't be highlighted from the start, but you can press a key or use the joystick and it will switch to controller input. Last, you can check to see what Unity is reporting by writing a script that checks in its Update function Input.GetAxis("Vertical") - this should react to up and down arrow keys.

meganuke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 33
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #6 on: March 20, 2017, 02:17:48 AM »
i see what is happening.

there is threshold, in order for NGUI to detect the input as "keyboard" i need to keep the key pressed a little longer, then it works, but if i just do a quick hit, its detected like "mouse".

can this be configured?

meganuke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 33
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #7 on: March 20, 2017, 02:31:00 AM »
scratch that last post.
what was happening (in that last test) was that the input was being handled as a joystick.

if i disable all inputs but keyboard,  key navigation doesnt work at all.


using debug.log i can see the input values. going to 1 and -1


latest unity version, latest ngui.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #8 on: March 21, 2017, 04:24:11 PM »
Right, controller input is what you need, not keyboard. If you look at the Example 4 that comes with NGUI, Mouse, Touch and Controller are enabled. Keyboard is disabled. Yet keyboard input still works -- because Input.GetAxis are used and keys are bound to axes, so it works as expected.

meganuke

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 33
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #9 on: March 27, 2017, 08:44:40 AM »
Im sorry, do you believe your answer is satisfactory?

im reporting something that does not work as expected.

and you only provide a workaround and say "as expected".

No, thats not as expected.

Even if i use your workaround, the keyboard input is being read like analog input, which means that in order for the focus to move to the next keynavigation the user has to keep the key pressed for like 2 seconds.

does this sounds "as expected" to you? is it ok for a commercial game to ask the user to press the keys for 2 seconds to navigate a menu?


as i told you before, i already have my menues working using
UICamera.controllerNavigationObject = Buttons[selectedbutton];


Im reporting this because i want to see Ngui improved, better each day, and really working "as expected"

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICamera Input problem (affecting key navigation)
« Reply #10 on: March 31, 2017, 12:56:28 PM »
Check your Input settings. By default, keyboard input axes have Sensitivity set to 1000 -- meaning they are instant. As soon as you press the button, the value of the axis becomes '1'. If yours do not, then it's your input settings that are causing your 2 second delay. If you create a brand new project and import NGUI, keyboard navigation will work instantly because of the default sensitivity being 1000.

You mentioned you made a brand new project -- why isn't the default sensitivity set to 1000 in a brand new project for you?