-
Notifications
You must be signed in to change notification settings - Fork 328
FIX: The button is not clickable when using Windows touch simulation inputs (ISXB-483) #2012
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
FIX: The button is not clickable when using Windows touch simulation inputs (ISXB-483) #2012
Conversation
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.
Code changes look good, I think I need to check this again to figure out how this is intended to work. I think you need to run formatter on the code.
Packages/com.unity.inputsystem/InputSystem/Plugins/EnhancedTouch/TouchSimulation.cs
Outdated
Show resolved
Hide resolved
InputUser.onChange += PairSimulatedTouchscreenOnChange; | ||
} | ||
} | ||
private void PairSimulatedTouchscreenOnChange(InputUser user, InputUserChange change, InputDevice device) |
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.
Is the reported issue also an issue when not using control schemes or does it only surface when the control schemes are present? Basically what would the intended behavior be in case a user was using a real mouse and a real touch screen at the same time? I would expect ping ponging effects on pointer. So maybe this is different since one want to avoid that and the current system do not support reasoning about sources of synthesised events...
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.
Is the reported issue also an issue when not using control schemes or does it only surface when the control schemes are present?
I didn't test this without control schemes, as they essentially control the PlayerInput use device pairing mechanism (which uses input events). And the problem is pairing mechanism was not taking into account the simulated touchscreen, because it doesn't generate input events.
Basically what would the intended behavior be in case a user was using a real mouse and a real touch screen at the same time? I would expect ping ponging effects on pointer
Yes that would be the behavior. But for this case, mouse (or pen) doesn't exist as its driving the simulated touchscreen. Also the ping pong only ocurrs if "Auto-switch" in PlayerInput is selected. Unless I'm misunderstanding something.
I'm confused with what you mean with this. Can you clarify?
So maybe this is different since one want to avoid that and the current system do not support reasoning about sources of synthesised events...
Based on review and code comments, this seems like a better solution that fixes the main problem and also better simulates a touchscreen when used together with PlayerInput. Automatic pairing and control scheme occurs now since we're using input events a real device would also use.
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.
LGTM. Side-note: Its extremely odd that this primaryTouch is not part of the array, but that is unrelated to your PR
@jfreire-unity is this ready to look at? There's a lot of CI failures |
Not yet. I'll make sure to ping you when it's done. Dealing with CI failures first |
The previous logic was based on changing state and didn't apply if we queued events. Also, this commit avoids processing the queued events for the simulated Touchscreen.
Will check today |
93d31be
to
42a43dd
Compare
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.
Updating status, had an issue with simulated multi touch events staying active. More details in DM
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.
LGTM, checked real and simulated touches on Windows and Android in a couple of touch samples as well as the user's project (after fixing their input actions) Did not test pen support though as I do not have the device for it
Description
Fixes ISXB-483
Simulated touches were not processed using Touch simulation (Input Debug > Options > Simulate Touch Input) with the PlayerInput component. This PR addresses that.
Changes made
Made sure the simulated touchscreen is paired with the PlayerInput users' devices.TouchSimulation queues input events instead of changing state. This triggers device pairing and control scheme switching of PlayerInput.
And also, makes the events show up in Input Debugger.
Kapture.2024-09-26.at.15.52.38.mp4
Testing
Tested:
Careful⚠️ : For the specific project of the bug report, the actions that have touch bindings are not set to the Touch control scheme. So the simulated touchscreen/real touchscreen will not work out of the box. The InputActionAsset actions for touchscreen devices need to be changed to included "Touch" control scheme:

Risk
Minimal regression risk. I validated that queuing these simulated events still occurs in the same frame where they were generated from Mouse/Pen.
Checklist
Before review:
Changed
,Fixed
,Added
sections.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: