Impossible to get cancelling of control rebind working with both keyboard and gamepad

I tried an alternative solution:

        rebind = actionReference.action.PerformInteractiveRebinding()
            .WithTargetBinding(bindingIndex)
            .OnPotentialMatch(operation =>
            {
                if (   operation.selectedControl.path == "/Keyboard/escape"
                    || operation.selectedControl.path.Contains("/start"))
                {
                    operation.Cancel();
                }
            })
            .WithMatchingEventsBeingSuppressed()
            .OnCancel(_ => RebindCancelled())
            .OnComplete(_ => RebindComplete());

However, ultimately I had to go with the solution of checking for cancel in Update. In my remapping screen, some of the buttons are just for gamepads and some are just for keyboard. This prevents both remapping and cancelling via the alternative device, e.g. if you try to rebind a keyboard binding, the keyboard must be used to cancel it. This would fail Steam’s requirements for games with full controller support.

1 Like