InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

InputActions for keyboards and gamepads do not have a modifier that corresponds to Input.GetButtonUp

Open jackpr-unity opened this issue 8 years ago • 7 comments

Keyboard keys and gamepad buttons both have a "pressed" action. This action is the equivalent of Input.GetButtonDown.

There is not currently an equivalent action to Input.GetButtonUp.

jackpr-unity avatar Mar 19 '18 23:03 jackpr-unity

The equivalent is wasJustReleased. Input.GetButtonDown is equivalent to wasJustPressed.

isPressed is equivalent to Input.GetButton.

Rene-Damm avatar Mar 19 '18 23:03 Rene-Damm

I'm referring to action modifiers. See the attached image untitled

jackpr-unity avatar Mar 19 '18 23:03 jackpr-unity

I guess the correct verbage is: InputActions do not have a modifier that corresponds to Input.GetButtonUp

jackpr-unity avatar Mar 19 '18 23:03 jackpr-unity

Yup corect, not ATM. Would be easy to add a "Release" modifier for buttons though I'm a little unsure when exactly it'd be useful.

To some extent even the "Press" modifier seems like it shouldn't be there. Seems odd that the system doesn't understand button presses out of the box but needs an explicit modifier to handle those properly.

Rene-Damm avatar Mar 19 '18 23:03 Rene-Damm

I've used OnButtonUp many times in games. Here are some use cases:

  • Any UI button. Buttons don't usually engage their action until you release your click.
  • Press action to begin charging, release to fire a charged shot.
  • press to begin holding an object, release to let it go.

jackpr-unity avatar Mar 19 '18 23:03 jackpr-unity

Makes sense. And maybe it's okay requiring explicit "Press" and "Release" modifiers for these to work properly with button controls.

Rene-Damm avatar Mar 20 '18 16:03 Rene-Damm

There's a PressAndRelease interaction now. Action goes into Started when the button is pressed and Performed when it is released.

https://github.com/Unity-Technologies/InputSystem/blob/develop/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressAndReleaseInteraction.cs

Rene-Damm avatar Jun 08 '18 22:06 Rene-Damm