Skip to content

FIX: Suppress touch simulation while the Device Simulator is open [UUM-153420] - #2484

Merged
jfreire-unity merged 7 commits into
developfrom
bugfix/UUM-151404-device-simulator-duplicate-touches
Sep 22, 2026
Merged

jfreire-unity merged 7 commits into
developfrom
bugfix/UUM-151404-device-simulator-duplicate-touches

Conversation

@jfreire-unity

@jfreire-unity jfreire-unity commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Description

Backport of trunk PR unity/unity#123402.

Problem

A single mouse click in the Device Simulator produces two active touches when "Simulate Touch Input From Mouse or Pen" is enabled in the Input Debugger. EnhancedTouch.Touch.activeTouches reports two entries with different touch IDs, in different coordinate spaces, both at finger index 0:

[0] {id=1 finger=0 phase=Began position=(1754.00, 858.00) ...}
[1] {id=4 finger=0 phase=Began position=(490.40, 202.40) ...}

Fixes UUM-151404 which was reported through LinkedIn, and we could not exactly reproduce what the user mention in the specific versions. 1.19 actually didn't reproduce this bug because it was obfuscated by another bug fixed in 1.20.

Cause

Two Touchscreen devices are live at once and each produces a touch per click:

  • "Device Simulator Touchscreen", added by InputSystemPlugin, fed from DeviceSimulator.touchScreenInput.
    • For Input System, UITK callbacks are used to be converted into touchscreen events in the queue.
  • "Simulated Touchscreen", added by TouchSimulation, fed from Mouse/Pen events.

Nothing has ever prevented these two from coexisting, so they are in fact producing separate events.

Solution

Pragmatic fix: TouchSimulation now skips event processing while a Device Simulator view is open, so the Device Simulator's touchscreen is the only source of "simulated touches". The Input Debugger's toggle is shown as unavailable while a simulator is open, since it would otherwise appear to work while having no effect.

This means Device Simulator in fact takes over "Touch Simulation".

Testing status & QA

Test suite was run locally on 6000.0 at least.

Overall Product Risks

  • Complexity: 1
  • Halo Effect: 1

Comments to reviewers

Code is the same as the trunk PR.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

…M-151404]

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

Needs changes

The touch-suppression implementation is coherent, but the added fixture lifecycle does not preserve pre-existing simulator state across test runs.

Reviewed commit f88f5e9

🤖 Helpful? 👍/👎

Comment thread Assets/Tests/InputSystem/Plugins/DeviceSimulatorTests.cs
@jfreire-unity

Copy link
Copy Markdown
Collaborator Author

💡 Harness Review

Needs changes

The touch-suppression implementation is coherent, but the added fixture lifecycle does not preserve pre-existing simulator state across test runs.

Reviewed commit f88f5e9

🤖 Helpful? 👍/👎

Looks worse than it sounds, it's a small corner case improvement for testing and is not a blocker.

@jfreire-unity jfreire-unity changed the title FIX: Suppress touch simulation while the Device Simulator is open [UUM-151404] FIX: Suppress touch simulation while the Device Simulator is open [UUM-153420] Sep 21, 2026

@Pauliusd01 Pauliusd01 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick recheck on 6000.0.74f1, lgtm

@ekcoh

ekcoh commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Approving but the P1 findings sounds/looks real to me, I would suggest fixing that separately across versions then.

@codecov-github-com

codecov-github-com Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 90.78947% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...InputSystem/Editor/Debugger/InputDebuggerWindow.cs 0.00% 4 Missing ⚠️
...m/Runtime/Plugins/EnhancedTouch/TouchSimulation.cs 92.00% 2 Missing ⚠️
...System/Editor/DeviceSimulator/InputSystemPlugin.cs 66.66% 1 Missing ⚠️
@@           Coverage Diff            @@
##           develop    #2484   +/-   ##
========================================
  Coverage    78.95%   78.96%           
========================================
  Files          767      767           
  Lines       140914   140989   +75     
========================================
+ Hits        111262   111333   +71     
- Misses       29652    29656    +4     
Flag Coverage Δ
inputsystem_MacOS_6000.0 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.0_project 77.50% <90.78%> (+0.01%) ⬆️
inputsystem_MacOS_6000.3 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.3_project 77.50% <90.78%> (+0.01%) ⬆️
inputsystem_MacOS_6000.6 5.29% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.6_project 77.56% <90.78%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.0 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.0_project 77.41% <90.78%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.3 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.3_project 77.41% <90.78%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.6 5.29% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.6_project 77.47% <90.78%> (+0.01%) ⬆️
inputsystem_Windows_6000.0 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.0_project 77.63% <90.78%> (+0.01%) ⬆️
inputsystem_Windows_6000.3 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.3_project 77.62% <90.78%> (+0.01%) ⬆️
inputsystem_Windows_6000.6 5.29% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.6_project 77.69% <90.78%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../Tests/InputSystem/Plugins/DeviceSimulatorTests.cs 100.00% <100.00%> (ø)
...System/Editor/DeviceSimulator/InputSystemPlugin.cs 74.00% <66.66%> (-0.23%) ⬇️
...m/Runtime/Plugins/EnhancedTouch/TouchSimulation.cs 91.07% <92.00%> (+0.61%) ⬆️
...InputSystem/Editor/Debugger/InputDebuggerWindow.cs 2.38% <0.00%> (-0.01%) ⬇️

... and 1 file with indirect coverage changes

ℹ️ Need help interpreting these results?

jfreire-unity and others added 5 commits September 21, 2026 14:18
…ader so PVP-40-1 passes

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…gelog header so PVP-40-1 passes"

This reverts commit c714cec.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jfreire-unity jfreire-unity self-assigned this Sep 22, 2026
@jfreire-unity

Copy link
Copy Markdown
Collaborator Author

I'm forcing landing this. The failure that currently exists is also on develop and i'm trying to fix it with https://github.cds.internal.unity3d.com/unity/pets.pvp-catalog/pull/306

@jfreire-unity
jfreire-unity merged commit c61cc67 into develop Sep 22, 2026
68 of 70 checks passed
@jfreire-unity
jfreire-unity deleted the bugfix/UUM-151404-device-simulator-duplicate-touches branch September 22, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants