2
\$\begingroup\$

By default, Unity's keyboard navigation for buttons seems to check for GetButton rather than GetButtonDown--if a menu has 5 items and I hold the down arrow, it'll scroll very quickly to the bottom.

This feels awkward; it would make more sense to check for GetButtonDown and only move 1 space per input. However, I can't find any option to let me change that. Any ideas or workarounds?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Sadly there's currently no way to make Unity's keyboard navigation to use GetButtonDown instead of GetButton.

However, EventSystem -> Standalone Input Module exposes an Input Actions per Second variable.

The default value is 10 seconds.
If you change it to a lower value, like 3, you will slow down considerably the scroll to bottom speed.

Because picking a low value for this setting will limit your in-game input, you might want to set different values in your menu and game scenes via code. http://docs.unity3d.com/ScriptReference/EventSystems.StandaloneInputModule.html

\$\endgroup\$
4
  • \$\begingroup\$ Hm, okay. But wouldn't that result in the game throwing out some inputs? \$\endgroup\$
    – eternal
    Jun 15, 2015 at 15:51
  • \$\begingroup\$ You are correct. For this reason, you might want to set different values for this setting (via code) in your menu and game scenes. \$\endgroup\$ Jun 15, 2015 at 16:32
  • 1
    \$\begingroup\$ It might make more sense to use StandaloneInputModule.repeatDelay and set it to somewhere between 0.5f-1.0f that way the User can tap the arrow key to navigate menu items like normal but holding it down won't immediately start scrolling rapidly. Setting this to a really high value would simulate using GetButtonDown since it wouldn't repeat unless the key was held down for a long period. \$\endgroup\$ Jun 16, 2015 at 6:52
  • \$\begingroup\$ repeatDelay sounds like it would work perfectly, but I can't seem to access it. My script is already using UnityEngine.EventSystems, but when I type in the class StandaloneInputModule, I don't get any of its variables. \$\endgroup\$
    – eternal
    Jun 16, 2015 at 8:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .