Welcome,
Guest
. Please
login
or
register
.
January 12, 2025, 11:23:37 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
UIKeyNavigation - Double tapping a direction deselects the current button
« previous
next »
Print
Pages: [
1
]
Author
Topic: UIKeyNavigation - Double tapping a direction deselects the current button (Read 3597 times)
Lork
Newbie
Thank You
-Given: 1
-Receive: 0
Posts: 3
UIKeyNavigation - Double tapping a direction deselects the current button
«
on:
August 10, 2017, 05:19:43 PM »
If mouse events are enabled, quickly double tapping a direction will deselect the current button. This is not just a visual glitch, as the submit button won't do anything in this state. The position is still remembered though as you can recover by pressing a direction again to select an adjacent button. It's easiest to see this in menus that only let you move on one axis (eg. double tapping left or right on a vertical menu) but it still happens even if the direction you're tapping is changing selections at the same time.
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: UIKeyNavigation - Double tapping a direction deselects the current button
«
Reply #1 on:
August 12, 2017, 12:30:41 PM »
When you have key navigation, you should ideally turn off other forms of input. If you engage another form of input, such as touch or mouse, that effectively hides the key-based navigation. It's the expected behaviour.
Logged
Lork
Newbie
Thank You
-Given: 1
-Receive: 0
Posts: 3
Re: UIKeyNavigation - Double tapping a direction deselects the current button
«
Reply #2 on:
August 16, 2017, 05:05:53 PM »
The issue isn't caused by engaging other forms of input. The current button is deselected when a directional button on the keyboard is quickly pressed twice. Surely it's not expected behavior for keyboard input to hide key based navigation?
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: UIKeyNavigation - Double tapping a direction deselects the current button
«
Reply #3 on:
August 21, 2017, 06:27:30 PM »
I'm not seeing that behaviour here. Perhaps check your Input Manager settings in Unity? Do you have some joystick axis bound to arrow keys?
Logged
Lork
Newbie
Thank You
-Given: 1
-Receive: 0
Posts: 3
Re: UIKeyNavigation - Double tapping a direction deselects the current button
«
Reply #4 on:
August 29, 2017, 08:08:42 PM »
To reproduce:
-Start a new project, import NGUI and set up the Pan axes.
-Open the controller input example scene.
-Check the keyboard box on UICamera (so that keyboard, mouse and controller are checked)
-Double tap a direction OR press any button on the keyboard that isn't assigned in UICamera's axes and keys.
While setting up this test I learned that the problem actually stems from the interaction between keyboard and mouse events. Controller and mouse events seem to get along just fine.
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: UIKeyNavigation - Double tapping a direction deselects the current button
«
Reply #5 on:
August 30, 2017, 04:39:14 PM »
Looked into it. Seems it's actually a conflict between mouse input and controller input. You can fix it by opening up UICamera, line 2181:
if
(
!
wasPressed
)
change to:
if
(
!
wasPressed
&&
posChanged
)
The downside of this will be that NGUI won't keep updating the object underneath the mouse unless the mouse actually moves now -- which may or may not be what you want.
Edit: Actually you can resolve the downside above by changing the code right above it:
// No need to perform raycasts every frame
if
(
isPressed
||
posChanged
||
mNextRaycast
<
RealTime
.
time
)
{
mNextRaycast
=
RealTime
.
time
+
0
.
02f
;
Raycast
(
currentTouch
)
;
if
(
mMouse
[
0
]
.
current
!=
currentTouch
.
current
)
{
currentKey
=
KeyCode
.
Mouse0
;
posChanged
=
true
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
mMouse
[
i
]
.
current
=
currentTouch
.
current
;
}
}
«
Last Edit: August 30, 2017, 04:52:54 PM by ArenMook
»
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
UIKeyNavigation - Double tapping a direction deselects the current button