Actions with multiple bindings workaround

Hi,
let’s say the X key performs action 1 and I have another action (action 2) with it’s binding being a modifier (shift + X) and then I press shift + X, that ends up performing both action 1 and action 2.
I know this is a limitation that hasn’t been addressed yet in the new input system but do you guys have any workaround for this situation?

Thank you in advance for your answers

Hi Ahmed,

There have been a few workarounds posted previously, with this first one handling button combinations via code:

And then another using Composite Bindings in the InputManager window:

Personally I would lean towards the first as I don’t have much experience with Composite Bindings, and setting up something like:

void OnShiftDown()
{
    pressingShift = true;
}

void OnShiftUp()
{
    pressingShift = false;
}

void OnXInput()
{
    if (pressingShift)
        RunXInput1();
    else
        RunXInput2();
}

can be done fairly quickly, though I understand it’s not ideal!
I hope this helps!

1 Like

Thanks for the reply Sam, I actually tried the first approach as it is simpler but for some reason (I’m gonna use your example to illustrate) OnXInput() runs before OnShiftDown() so I end up with the normal button pressed before the modifier can alter the boolean

Oh that’s interesting, how are your ‘Shift’ and ‘X’ inputs set up in the InputManager?

I tried multiple settings and none of them worked (except the one I attached in the image). I got it working by adding a hold interaction on the single button (W) but that only worked with Pass Through action type when I tried Button action type it only worked the first time after I pressed the play button then it stopped.


7235996--871151--2.png

ah, does that mean you’ve been able to fix the problem? I’m not sure what else you could try other than listing both Shift and W as separate actions, but it sounds like you might run into that ‘Pass Through’ vs ‘Button’ issue again :frowning:

1 Like

yes the problem is gone now. also listing both keys as separate actions will also be a viable solution.
thanks for your fast replies and help it’s much appreciated. :slight_smile:

1 Like