Skip to main content
New Participant
August 1, 2025

Button combo using buttons from both controllers

  • August 1, 2025
  • 3 replies
  • 92 views

Beginner developer here, creating my own input actions where I have to press the Left trigger and the Right Primary Button (A) together to do something.

In my Input Actions Editor, under the custom action SwitchMode, I added a binding with one modifier. Left trigger for binding and RightPrimaryButtonPressed for modifier. For testing, my function is as follows:

void OnSwitchMode(){

   print("Mode Switched");

}

I do not get an output on the Console. However when I had both binding and modifier on the same controller (Left trigger, Left primarybutton or the right equivalent), an input is registered and I get a message on the Console.

Why is that? And is there any way to get around this?

    This topic has been closed for replies.

    3 replies

    RiverExplorer
    Honored Contributor
    August 1, 2025

    I did not fully understand your question.

    The way I do that kind of thing is use a OnLeftTrigger() and OnRightTirgger() as separate input actions.

    Set a LeftTriggerIsPressed boolean when performed and un-sets it on canceled in OnLeftTrigger.

    Set a RightTriggerIsPressed boolean if performed and un-sets it on canceled in OnRightTrigger.

    Then in both the OnLeftTrigger() and OnRightTirgger() I have 

         ... if (LeftTriggerIsPressed && RightTriggerIsPressed) {

           DoMyThing();

        }

       ...

     

    RiverExplorer.US]@gmail.com https://RiverExplorer.games
    New Participant
    August 2, 2025

    Right that makes sense, but why can't I use modifiers provided by the Input Actions Editor?

    Usually for button combinations I would just use modifiers, e.g. below OnCombo is called when both shift and space are pressed

    This doesn't seem to be working when i have a binding from my right meta quest 2 controller and a modifier from the left one. They're both under XR Controller in the binding path so I thought there wouldn't be a problem.

    I'd like to know why and is there any other way to get around it other than your mentioned method.

    RiverExplorer
    Honored Contributor
    August 2, 2025

    I had wanted when the 4 (A, B, X, Y) buttons were pressed in different combinations to do things. I could never get it to work. I had assumed it could not (Implementation did not support it), or poor documentation from Unity.

     

    RiverExplorer.US]@gmail.com https://RiverExplorer.games