WithCancelingThrough("<Keyboard>/escape") also cancels with "<Keyboard>/e"

Just the latest of many issues with the new Input System, I found today that specifying "/escape" for cancelling an interactive rebinding operation will also cancel the rebinding operation if the user presses the E key on the keyboard, meaning that we cannot rebind the input action to E. Suspecting the system was matching the substring of "/escape" with "/e", I changed the cancelling key to "/backspace". And pressing B on the keyboard now cancelled the rebind operation. Substring test confirmed.

We're trying to use this for a commercial game, but I do not think that Input System, even at version 1.3.0, is ready for commercial use yet.

6 Likes

Implemented a work-around. In the onComplete callback, check the candidates for the desired cancel inputs and cancel it ourselves.

        bool canceled = operation.canceled;
        if (!canceled)
        {
            // RebindingOperation has a bug where WithCancelingThrough("<Keyboard>/escape") matches
            // "<Keyboard>/e" so it looks like have to do it manually
            foreach (var candidate in operation.candidates)
            {
                if (string.Compare(candidate.path, "/Keyboard/escape", ignoreCase: true) == 0
                    || string.Compare(candidate.path, "/Gamepad/start", ignoreCase: true) == 0)
                {
                    canceled = true;
                    break;
                }
            }
        }
        if (canceled)
        {
            Debug.Log("Rebind canceled");
            inputAction.ApplyBindingOverride(bindingIndex, previousBinding);
        }
1 Like

Fixed in upcoming 1.4.

Any ETA for 1.4?

Experiencing the same bug.

Latest ETA is package on production server end of next week.

1 Like

Great to know, thx!

[quote=“Rene-Damm”, post:5, topic: 870292]
Latest ETA is package on production server end of next week.
[/quote]
Any updates on this?

Bump @Rene-Damm any updates about the release date? We are experiencing this bug as well

Guessing it's held up in QA :|

And yeah, I've had angry negative reviews about this too.

1 Like

@Rene-Damm are you ok?

2 Likes

If anyone's looking for a gross solution in the meantime, override the cancel operation with total gibberish and manually handle in OnPotentialMatch:

ongoingRebind = action.PerformInteractiveRebinding(bindingIndex)
    .OnPotentialMatch(operation => {
      if (operation.selectedControl.path is "/Keyboard/escape") {
         operation.Cancel();
         return;
       }
   })
   // bug which prevents binding to the `e` key...
   // .WithCancelingThrough("<Keyboard>/escape")
   .WithCancelingThrough("an enormous string of absolute gibberish which overrides the default which is escape and causes the above bug")
8 Likes

Similarly, I have had bad reviews and negative public comments because of this issue... it would be great to get a fix; and for unity to stop sitting on critical fixes for so long. Its not the first time I experienced this long of a delay for a fix and I am starting to question unity after using it for 10 years. :(
The package system was supposed to stop this kind of update delay problems. It must be hard to work at unity when this keeps happening and something is slowing down or blocking them from making the product better in a reasonable way.

@Rene-Damm

Also stopping by to check on this issue, any news on a release? Also does it resolve all the issues with the name matching, as I'm pretty sure "a" matches "anyKey" and "r" matches "rightStick/up | rightStick/down | rightStick/left | rightStick/right"... and any other potential matches.

1 Like

[quote=“Razputin”, post:13, topic: 870292]
@Rene-Damm

Also stopping by to check on this issue, any news on a release? Also does it resolve all the issues with the name matching, as I’m pretty sure “a” matches “anyKey” and “r” matches “rightStick/up | rightStick/down | rightStick/left | rightStick/right”… and any other potential matches.
[/quote]

The Pull Request #1492 shows this fix to be in ComparePathElementToString() so while I can’t say for certain, it does appear to be a general case fix for those problems as well, yes.

1 Like

[quote=“jukibom”, post:11, topic: 870292]
If anyone’s looking for a gross solution in the meantime, override the cancel operation with total gibberish and manually handle in OnPotentialMatch:

ongoingRebind = action.PerformInteractiveRebinding(bindingIndex)
    .OnPotentialMatch(operation => {
      if (operation.selectedControl.path is "/Keyboard/escape") {
         operation.Cancel();
         return;
       }
   })
   // bug which prevents binding to the `e` key...
   // .WithCancelingThrough("<Keyboard>/escape")
   .WithCancelingThrough("an enormous string of absolute gibberish which overrides the default which is escape and causes the above bug")

[/quote]

Thank you so much for this. Had some time to try it out and it appears to work perfectly. I’ve added a check for “/Gamepad/start” too since I have both controls bound with the same method.

1 Like

[quote=“jgthibodeau”, post:15, topic: 870292]
Thank you so much for this. Had some time to try it out and it appears to work perfectly. I’ve added a check for “/Gamepad/start” too since I have both controls bound with the same method.
[/quote]

I should probably point out this should no longer be needed in the latest Input System 1.4.1 but I haven’t upgraded yet so I can’t say for certain.

[quote=“jukibom”, post:11, topic: 870292]
If anyone’s looking for a gross solution in the meantime, override the cancel operation with total gibberish and manually handle in OnPotentialMatch:

ongoingRebind = action.PerformInteractiveRebinding(bindingIndex)
    .OnPotentialMatch(operation => {
      if (operation.selectedControl.path is "/Keyboard/escape") {
         operation.Cancel();
         return;
       }
   })
   // bug which prevents binding to the `e` key...
   // .WithCancelingThrough("<Keyboard>/escape")
   .WithCancelingThrough("an enormous string of absolute gibberish which overrides the default which is escape and causes the above bug")

[/quote]

You are genius. Thank you so much

1 Like

@jukibom Thank you very much for the workaround!

-

1 Like

A year later and 1.4 still hasn't shown up in the package manager.