Search Unity

  1. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

Gamepad Navigation Control Sluggish

Discussion in 'UGUI & TextMesh Pro' started by JAKJ, Feb 15, 2015.

  1. JAKJ

    JAKJ

    Joined:
    Aug 17, 2014
    Posts:
    185
    I have all of the Unity defaults in the input manager, and I added additional Horizonal/Vertical entries for my gamepad's D-pad (Xbox 360 controller, so the D-pad is a pair of axes). I added a bunch of buttons to a new project and tested.

    Keyboard navigation works fine (arrows, wasd), but was constantly moving more than one button at a time, so I turned "Input Actions Per Second" down to 3, which worked great for keyboard, but navigating with the control stick or the D-pad became extremely sluggish to initiate.

    I turned "Input Actions Per Second" up to 60, and the sluggishness went away immediately and the control stick and D-pad became fully responsive, but of course the UI is not usable in that state as every navigation ends up zooming across the buttons.

    I looked at the source code for Standalone Input Module, but only one line of code even uses that number so I can't understand how the keyboard keys can be responsive but not the axes at the same time. I tried turning up the gravity and turning on snap but that did nothing, and I tried turning up the sensitivity but that screwed it up with somehow queueing extra navigation in some weird way.

    How can I get axes to not have a horrendous activation delay when "Input Actions Per Second" is low?

    EDIT: I found this:

    Code (CSharp):
    1. private bool AllowMoveEventProcessing(float time)
    2.         {
    3.             bool allow = Input.GetButtonDown(m_HorizontalAxis);
    4.             allow |= Input.GetButtonDown(m_VerticalAxis);
    5.             allow |= (time > m_NextAction);
    6.             return allow;
    7.         }
    That's what's doing it: GetButtonDown must be returning false because I'm not pressing any keyboard or gamepad buttons and axes aren't buttons, so it's simply waiting until the next "tick" before even trying to do it. But I can't simply remove that time check because then it'll issue an event every Update pass. I'm not sure how to fix this: What needs to happen is that "time > m_NextAction" check be skipped if this is the first time the axis has been non-neutral since it's been neutral.
     
    Last edited: Feb 15, 2015
  2. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,660
    hmm, that is an interesting one. next time I get to play with the source I'l see if I can come up with a solution.
    For now it's best to simply log an issue using the Unity Bug reporter and a sample project showing the issue. I agree, it is an annoying position.

    A simple work around is to track if the user is using Gamepad or keyboard and set the Input Actions Per second value accordingly. Not nice having to switch but should be a good stop gap for now.
     
unityunity