Skip to content

Commit 98fe22a

Browse files
committed
Set pointer buttons back to default so the values are properly based on new event data
1 parent 88514ee commit 98fe22a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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)