[SOLVED] Get Mouse Button Up with the new input system

I’m trying to globally detect if a user has released the mouse.
Old: Input.GetMouseButtonUp(0)

I thought I could read it from Mouse.current.leftButton.ReadValue(), but that only returns 0 or 1

So I thought I’d register the left mouse button as an Action in the new system. But I can’t find the option for release, it only gives me Hold, Press and Tap options.

Did you check the docs? There appears to be an .wasReleasedThisFrame property on a ButtonControl, but not sure if this applies in your above example.

2 Likes

There’s also these if you’re using InputActions: Class InputAction | Input System | 1.4.4

.started, .performed and .cancelled are parallels to GetKeyDown, GetKey, and GetKeyUp in respective order.

Thank you both. The easiest solution was @Kurt-Dekker .wasReleasedThisFrame, exactly what I wanted.

2 Likes

Also I found out that you can set a button to “Press” and in the Interactions set the Trigger Behaviour to “Release Only”.

1 Like