-
Notifications
You must be signed in to change notification settings - Fork 325
FIX: Pen touch input triggers UI/Click action two times (ISXB-1456) #2201
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
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2201 +/- ##
===========================================
- Coverage 68.10% 68.10% -0.01%
===========================================
Files 367 367
Lines 53610 53601 -9
===========================================
- Hits 36513 36504 -9
Misses 17097 17097
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR addresses an issue where pen/touch input could generate duplicate UI/click actions by simplifying pointer cleanup logic and enhancing the UI pointer integration tests.
- Removed special-case handling that delayed touch-pointer removal by one frame
- Simplified
FilterPointerStatesByType
to only remove non–mouse/pen pointers - Expanded UI tests to cover simultaneous mouse and touch input and ensure single-click behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs | Commented out touch-delay block and changed pointer-filter condition |
Assets/Tests/InputSystem/Plugins/UITests.cs | Added new test scenario for concurrent mouse and touch clicks |
Comments suppressed due to low confidence (2)
Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs:2365
- This simplified condition now removes touch pointers immediately, which may contradict the intended one-frame delay for touch cleanup. Verify that touch removal timing still matches expected input behavior and adjust the condition to retain touch pointers when needed.
if (m_PointerStates[i].pointerType != UIPointerType.MouseOrPen)
Assets/Tests/InputSystem/Plugins/UITests.cs:1464
- The test calls
EndTouch
on ID 1, but no touch with ID 1 was started here. This mismatch may prevent proper cleanup of the previous touch and lead to false positives. EnsureEndTouch
uses the same touch ID as the correspondingBeginTouch
.
EndTouch(1, secondPosition, screen: touch1);
// // We don't want to release touch pointers on the same frame they are released (unpressed). They get cleaned up one frame later in Process() | ||
// ref var state = ref GetPointerStateForIndex(index); | ||
// if (state.pointerType == UIPointerType.Touch && (state.leftButton.isPressed || state.leftButton.wasReleasedThisFrame)) | ||
// { | ||
// // The pointer was not removed | ||
// return false; | ||
// } |
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.
[nitpick] The double-commented block clutters the cleanup logic. Consider removing these dead code lines or extracting them behind a clearly named feature flag to improve readability.
// // We don't want to release touch pointers on the same frame they are released (unpressed). They get cleaned up one frame later in Process() | |
// ref var state = ref GetPointerStateForIndex(index); | |
// if (state.pointerType == UIPointerType.Touch && (state.leftButton.isPressed || state.leftButton.wasReleasedThisFrame)) | |
// { | |
// // The pointer was not removed | |
// return false; | |
// } | |
// Removed dead code block for clarity and readability. |
Copilot uses AI. Check for mistakes.
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 will be removed, it's just to help with testing at the moment.
fb31fe7
to
96b6291
Compare
Description
Please fill this section with a description what the pull request is trying to address and what changes were made.
Testing status & QA
Please describe the testing already done by you and what testing you request/recommend QA to execute. If you used or created any testing project please link them here too for QA.
Overall Product Risks
Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.
Comments to reviewers
Please describe any additional information such as what to focus on, or historical info for the reviewers.
Checklist
Before review:
Changed
,Fixed
,Added
sections.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: