-
Notifications
You must be signed in to change notification settings - Fork 331
FIX: handled events still triggering actions when switching PlayerInput #2340
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
base: develop
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍(Review updated until commit 8c58fe7)Here are some key observations to aid the review process:
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
PR Code Suggestions ✨🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2340 +/- ##
========================================
Coverage 77.95% 77.96%
========================================
Files 476 476
Lines 97453 97420 -33
========================================
- Hits 75971 75949 -22
+ Misses 21482 21471 -11
🚀 New features to boost your workflow:
|
Test Plan
Summary of Changes & Risk AssessmentSummary of ChangesThis PR fixes a bug where physical button presses that generate multiple input events (common on controllers like DualSense) would still trigger actions even if the first event was marked as Risk Assessment
Test ScenariosFunctional Testing
Regression Testing
🔍 Regression Deep Dive (additional risks identified)
Edge Cases
💡 This test plan updates automatically when 🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
…n child objects" This reverts commit ee9aace.
|
Persistent review updated to latest commit 94564dc |
| new int[] { 0, 0, 0, 0, 1}, // started | ||
| new int[] { 0, 0, 0, 0, 1}, // performed | ||
| new int[] {0, 0, 0, 0, 0})] // cancelled | ||
| // Press event is not detected in step 1/2 with default interaction | ||
| [TestCase(InputEventHandledPolicy.SuppressActionEventNotifications, | ||
| null, | ||
| new int[] { 0, 0, 0, 0, 1}, | ||
| new int[] { 0, 0, 0, 0, 1}, | ||
| new int[] {0, 0, 0, 1, 1})] | ||
| // Press event is detected in step 2 (false positive) with explicit press interaction | ||
| // Press event is suppressed in step 1/2 with explicit press interaction | ||
| [TestCase(InputEventHandledPolicy.SuppressStateUpdates, | ||
| "press", | ||
| new int[] { 0, 0, 1, 1, 2}, | ||
| new int[] { 0, 0, 1, 1, 2}, | ||
| new int[] {0, 0, 0, 1, 1})] | ||
| new int[] { 0, 0, 0, 0, 1}, | ||
| new int[] { 0, 0, 0, 0, 1}, | ||
| new int[] {0, 0, 0, 0, 0})] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a behavior change. What is the reason to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We needed a explicit way to keep action suppression working across update steps. It will ensure that actions doesn't trigger on next update which shows up as a false positive press like reported in the bug. Please correct me if I'm wrong - my understanding is,
- With
SupressStateUpdates, a handled press should not create started or performed in steps 1 or 2. - This change is removing the 2nd step false positive press and keeps the policy intact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, left some comments for clarification
…ed(...) and no longer early-exit the event loop when eventPtr.handled is set
|
Persistent review updated to latest commit 8c58fe7 |
Description
Bug: https://issuetracker.unity3d.com/issues/setting-inputeventptr-dot-handled-to-true-does-not-prevent-actions-from-triggering-when-changing-devices
When
InputUser.onUnpairedDeviceUsedmarkseventPtr.handled= true, we expect no action to fire from that samebutton press.
But on devices like DualSense, a single press can generate multiple input events. The handled flag only stops the
one event, and another event in the same press still triggers the action.
Root cause
The action system is driven by state change events. We can see different eventIds for the handled event vs the
action‑triggering event, so the action was coming from a separate input event.
Fix
InputSystem.onEvent, stop calling remaining listeners once handled becomes true.for the rest of the update (and next update).
InputActionState, skip processing control changes if the device is suppressed.Testing status & QA
Manually verified using repro project + dualsense controller.
Overall Product Risks
Comments to reviewers
SuppressStateUpdatesand a listener explicitly sets handled = true.the next event look like a new press which is now prevented.
Checklist
Before review:
Changed,Fixed,Addedsections.Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.