-
Notifications
You must be signed in to change notification settings - Fork 324
FIX: (ISXB-1524) Rebinding issues related to incorrect event suppression (WIP) #2168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ekcoh
wants to merge
25
commits into
develop
Choose a base branch
from
ekcoh/rebinding-issues-events
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ekcoh
commented
Apr 23, 2025
ekcoh
commented
Apr 23, 2025
ekcoh
commented
Apr 23, 2025
Tried running tests with this setting on all the time yields failures on: |
…nologies/InputSystem into ekcoh/rebinding-issues-events
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
work in progress
Indicates that the PR is work in progress and any review efforts can be post-poned.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fix originates from users reporting issues with rebinding functionality and differences between Xbox gamepad and
DualShock/DualSense. The problem surfaces when a control, e.g. button is targeted in rebinding that is already associated with an action doing something else outside the context of rebinding, but generally unintentional triggering of actions in relation to the rebinding process.
According to support engineers and customer, improved rebinding UI sample (commit which was improved to address this issue works well with Xbox gamepad but not with Sony gamepads. This have been verified on Windows. On macOS also Xbox gamepads have issues.
It turns out the difference between Xbox and DualShock/DualSense has nothing to do with the
gamepads but is a function of the underlying backend behaviour and/or filtering behaviour since lack of filtering will generate new samples solely based on analog control noise and repeat button states effectively bypassing current event suppression mechanism. This is also true if periodic state readings are being made without change filtering.
The problem
The existing
InputEvent.handled
flags marks an event as being "handled" which blocks event/state propagation. This is problematic if the associated InputEvent is not representing an event but a state reading. The reason for this can be shown by the example below. Consider an initial state where a button is in state 0 (not pressed), this corresponds to some event 'a'. A press event 'b' changes the state of the button to 1, but this event is for some reason suppressed, for example during rebinding. This blocks the event from propagating as a state change which is according to documentation ofInputEventPtr.handled
. This leads to "event" 'c' which is just a periodic reading that doesn't reflect a change to be seen as a change since 'b' was suppressed but 'c' wasn't suppressed. This implies that event 'c' would evaluate to a "press" since it is a state change from the perspective of the action state, but not from the state of the button. This is illustrated in figure below.If suppression instead had been allowed to propagate to update state, but not fire notifications outside internal data representation, the scenario would have been different since event/reading 'c' would not imply a state change:
Previous possible work around (Should not be used - will not work)
A slight improvement was suggested based on
OnMatchWaitForAnother(x)
, which seems to solvethe issue if time
x
is large enough (larger than a frame cycle). The reason this suggestion seem to work is due to input buffers being emptied/swapped on frame boundaries, typically leading to release by user before timeout. Since this functionality is time-based it do not provide a reliable solution and this workaround should not be used in production code. This is easily seen by. using this function on the branch and pressing a button in rebinding UI and never releasing it. As soon as suppression stops, the action bound to the rebind target will still fire.Proposed solution
It's currently assumed that event suppression logic in Input System is incorrect and hence it is being investigated as part of this PR. Essentially event suppression should only suppress events from firing but still allow state propagation updates since otherwise it is just postponing/deferring the problem. It's difficult to change this behavior without risking changing behaviour with side-effects in existing projects. Hence the current working assumption is that this need to be a setting and/or runtime property of the system to allow switching modes. Such a solution could temporarily switch mode during rebinding to solve the reported problem. This have been implemented as
InputSystem.inputEventHandledPolicy
property to control how the system processes handled events and the RebindingUI sample have been updated to use this via the new fluent-API extensionsWithSuppressedActionPropagation()
.It has been proven that uncommenting suppression early-exit within
InputManager.OnUpdate
eliminates an action callback when e.g. holding a button during rebinding, even when usingOnMatchWaitForAnother(x)
. This indicates that we need to allow interaction FSMs to update based on state changes but their output should be suppressed. This implies we either need to modify behavior of current suppress flag or introduce yet another suppress mechanism.Open questions to reviewers
Should we change behavior of event suppression during rebinding or may it have side-effects? Current changes do not do this but instead allow users to opt-in via fluent API or by changing property on InputSystem proxy API.
Testing status & QA
The current fix has been tested on macOS and Windows 10 and Window 11 using Xbox gamepad, DualShock gamepad and DualSense gamepad.
Overall Product Risks
Comments to reviewers
Main effort should be on solving customer issue but also to look for regressed behavior due to changer in event suppression logic.
The easiest way I have found to test this is as follows:
Update the input action asset in the RebindingUI sample to have an action "Test" that triggers on some gamepad button, e.g. Triangle on a DualSense. Add the script from step (1) to some game object within the Rebinding UI scene.
Run the Rebinding UI sample and rebind a button action to the same button as bound to Test action.
Observe behavior and compare to previous behavior. It's critical to test with both polled and event based gamepads, e.g. Xbox + Dualsense/Dualshock on Windows or any of them on macOS.
Checklist
Before review:
Changed
,Fixed
,Added
sections.EventHandledPolicy_ShouldReflectUserSetting
,Events_ShouldRespectHandledPolicyUponUpdate
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: