Can I have an action require multiple buttons?

Is there a way to set up an action as requiring multiple buttons to be pressed at the same time?
For example in most fighting games to perform a throw you have to simultaneous press two buttons, like block and punch at the same time.

Can I set up an action to require “A” and “B” to both be pressed?

EDIT: As I think about it, I just described two different things.
The example I used was a game calling an action from two actions pressed together.
What I was hoping to use in my game was calling an action from multiple keys pressed together.
The difference is in re-binding. If the user changes what button is punch that changes what buttons are pressed to perform a throw. The action I want to make would be separate from other actions, which is why I’m having trouble coding it in with this system.

ATM the only means supplied out of the box for setting this up are the ButtonWithOneModifier and ButtonWithTwoModifiers composites. So, for example, to require both “A” and “B” to be pressed, you could use ButtonWithOneModifier and assign one of the buttons as as “modifier” and the other as the “button” (will determine the value of the composite which in this case doesn’t really matter).

For rebinding, the two parts can be rebound individually.

An alternative is to write a custom composite.

2 Likes

@Rene-Damm re: #inputsystem, #Composites, #InputActions

Seeking guidance on a related quandary: to bind an accelerate button to the movement axes. Currently, since the vector2 is technically a composite already, I was unclear whether it could be bound with another key, enabling thrust (or swift, as I’ve currently labeled it). And inputting:

(InputAction.Player.Swift.Performed && IA.P.Move.Started) += Sprint();

Causes a flag that Action changes can only appear to the left of a += or -= procedure. (as in, OnEnable/OnDisable)

So then, should I create a logic gate in the OnMove(); Method? In Swift/Thrust as well? I’m sure it’s all complex on your end as well, Considering that action state changes send messages, yet most folks code the state machine to request status at set intervals. Crosstalk can be tricky to iron out.

Essentially, would it be better to write a custom composite to invoke a method, or draft it into a logic gate in state machine behaviour class? or is there another option that I’m missing… I read in the documentation that this might not be possible, as from Known Limitations: "

  • Actions cannot currently “pre-empt” each other’s input. Meaning that it is currently not possible to “consume” input from one action to prevent it from triggering input on another action.

  • A common scenario is having, for example, a binding for “A” on one action and a binding for “SHIFT+A” on another action. Currently, pressing “SHIFT+A” will trigger both actions. "

(I am self-taught from public resources, I would appreciate a response even if you just give me a general direction I might find guidance. Most things I eventually find are covered thoroughly somewhere, but google is biased toward forum posts. shrug)

1 Like

I support the comment above, it would be neat to have &&