Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feedback Too many rebinding candidates now

Discussion in 'Input System' started by nickleplated, Jan 29, 2020.

  1. nickleplated

    nickleplated

    Joined:
    Nov 2, 2018
    Posts:
    26
    In preview.3, there was a check in the RebindingOperation to see if the control's value had changed in the event before adding it as a candidate.
    Code (CSharp):
    1. // Skip controls that have no effective value change.
    2. // NOTE: This will run the full processor stack and is more involved.
    3. if (!control.HasValueChangeInState(statePtr))
    4.     continue;
    This was removed in preview.4 and, as a result, I now immediately get dozens of candidates on my HOTAS Warthog Throttle due to many switches being "on". They're all named Button##, so it's not easy to tell them apart. Before, I could just toggle the one I want and it would be the only one to show up.

    I've had to work around this by adding an OnComputeScore callback that does the value change check and returns a very low score if it hasn't changed. Then in OnPotentialMatch, I have to filter out all the candidates with low scores.

    Code (CSharp):
    1. .OnComputeScore(
    2.     (c, e) =>
    3.     {
    4.         unsafe
    5.         {
    6.             var statePtr = c.GetStatePtrFromStateEvent(e);
    7.  
    8.             // Skip controls that have no effective value change.
    9.             // NOTE: This will run the full processor stack and is more involved.
    10.             if (!c.HasValueChangeInState(statePtr))
    11.                 return -100f;
    12.  
    13.             // Otherwise do the normal scoring
    14.             var score = c.EvaluateMagnitude(statePtr);
    15.             if (!c.synthetic)
    16.                 score += 1f;
    17.  
    18.             return score;
    19.         }
    20.     })
    Is there a reason this check was removed and is there a better / easier workaround?
     
  2. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Yeah, I think this needs tweaking. Could you file a ticket for that one with the Unity bug reporter?

    RebindingOperation will now by default not let events with matching input pass through which means that the current value of the control doesn't actually change. So comparing the value in the event to the current value of the control won't work.

    The suppression is to make sure that nothing is reacting to the inputs further down the line. E.g. when rebinding to the gamepad's B button, the UI should not also trigger a cancel action.
     
  3. nickleplated

    nickleplated

    Joined:
    Nov 2, 2018
    Posts:
    26
    I've been trying to submit one, but it's been stuck "Uploading the report" at 57% since yesterday. I let it run all night hoping it would finish, but it hasn't. Is there another way to submit it?
    Edit: I tried again from home and successfully submitted it.

    I see what you mean. As is, my workaround prevents the controls from being candidates, but since the event state is always being compared against the pre-rebinding state instead of the previous event's state, when I toggle the control off and on again, it doesn't see the change.
    I can turn off the suppression to get it working, but then I have the potential issues that that fixed again.

    Is there an easy way to store the event state so I can compare it against the next one?
     
    Last edited: Jan 31, 2020
  4. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
  5. nickleplated

    nickleplated

    Joined:
    Nov 2, 2018
    Posts:
    26
    Awesome, thanks!