Skip to content

Commit 95ab1a9

Browse files
authored
FIX: Reset ButtonStates when re-using eventData with SingleUnifiedPointer (#2139)
1 parent 7a6cb91 commit 95ab1a9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ however, it has to be formatted properly to pass verification tests.
1212

1313
### Fixed
1414
- Fixed an issue where all action maps were enabled initially for project wide actions, which overrode the PlayerInput action map configuration. [ISXB-920](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-920)
15+
- Fixed an issue where ButtonStates are not fully updated when switching SingleUnifiedPointer. [ISXB-1356](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1356)
1516

1617
### Changed
1718
- Changed enum value `Key.IMESelected` to obsolete which was not a real key. Please use the ButtonControl `imeSelected`.

Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,6 +1931,15 @@ private int GetPointerStateIndexFor(InputControl control, bool createIfNotExists
19311931
// Make sure these don't linger around when we switch to a different kind of pointer.
19321932
eventData.trackedDeviceOrientation = default;
19331933
eventData.trackedDevicePosition = default;
1934+
1935+
// We only have a single pointer state and current frame press state values was based on previous eventData.
1936+
// Make sure these get updated when we switch.
1937+
if (m_PointerBehavior == UIPointerBehavior.SingleUnifiedPointer)
1938+
{
1939+
pointer.leftButton.OnEndFrame();
1940+
pointer.rightButton.OnEndFrame();
1941+
pointer.middleButton.OnEndFrame();
1942+
}
19341943
}
19351944

19361945
if (pointerType == UIPointerType.Touch)

0 commit comments

Comments
 (0)