Skip to content

Commit 8a57d62

Browse files
LeoUnityritamerkl
andauthored
FIX: OnMouseUpAsButton dropped in Play mode on Game view focus change (#2428)
Co-authored-by: Rita Merkl <127492464+ritamerkl@users.noreply.github.com>
1 parent ee735e6 commit 8a57d62

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@
7272
"expression": "6000.3.0a6",
7373
"define": "UNITY_INPUT_SYSTEM_PLATFORM_POLLING_FREQUENCY"
7474
},
75+
{
76+
"name": "Unity",
77+
"expression": "6000.4.0a4",
78+
"define": "UNITY_INPUTSYSTEM_SUPPORTS_MOUSE_SCRIPT_EVENTS"
79+
},
7580
{
7681
"name": "Unity",
7782
"expression": "6000.5.0a8",

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3232
- Fixed an incorrect ArraysHelper.HaveDuplicateReferences implementation that didn't use its arguments right [ISXB-1792] (https://github.com/Unity-Technologies/InputSystem/pull/2376)
3333
- Fixed `InputAction.IsPressed`, `WasPressedThisFrame`, and `WasReleasedThisFrame` using a `ButtonControl`'s `pressPoint` when a binding also had an explicit `PressInteraction` with its own `pressPoint`, which could make those APIs disagree with the interaction's press and release behavior. Action-level press APIs now follow the interaction threshold when both are set explicitly.
3434
- Fixed `IndexOutOfRangeException` in `InputDeviceBuilder` when connecting an HID gamepad whose report descriptor declares a hat switch with Report Size 8 (e.g. ESP32-BLE-Gamepad). The HID layer now anchors the hat's directional sub-controls to the hat's own byte instead of letting the layout system auto-allocate a fresh byte for each [UUM-143659](https://jira.unity3d.com/browse/UUM-143659).
35+
- Fixed `OnMouseUpAsButton` and `OnMouseUp` being dropped in Play mode when the Game view's focus changes between a press and its release on Unity 6000.5.0a8 and newer. The legacy `SendMouseEvents` pipeline is no longer driven from `InputUpdateType.Editor` updates, which read the editor state buffer (position (0,0), not pressed) and produced a spurious mouse release that cleared the press target.
3536
- Fixed Input Debugger window's incorrect name. It is now called 'Input Debugger' instead of 'Input Debug' [UUM-137124](https://jira.unity3d.com/browse/UUM-137124).
3637

3738
### Changed

Packages/com.unity.inputsystem/InputSystem/Runtime/InputManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4069,7 +4069,9 @@ private void FinalizeUpdate(InputUpdateType updateType)
40694069
//send pointer data to backend for OnMouseEvents
40704070
#if UNITY_INPUTSYSTEM_SUPPORTS_MOUSE_SCRIPT_EVENTS
40714071
var pointer = Pointer.current;
4072-
if (pointer != null && pointer.added && gameIsPlaying)
4072+
// Skip during InputUpdateType.Editor: pointer reads the editor state buffer (position (0,0), not pressed),
4073+
// which would emit a spurious release and drop OnMouseUp/OnMouseUpAsButton on the real release.
4074+
if (pointer != null && pointer.added && gameIsPlaying && updateType != InputUpdateType.Editor)
40734075
NativeInputSystem.DoSendMouseEvents(pointer.press.isPressed, pointer.press.wasPressedThisFrame, pointer.position.x.value, pointer.position.y.value);
40744076
#endif
40754077
m_CurrentUpdate = default;

0 commit comments

Comments
 (0)