Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to handle button combos using Input System?

Discussion in 'Input System' started by mauricioFigueroa, Mar 31, 2021.

  1. mauricioFigueroa

    mauricioFigueroa

    Joined:
    Dec 2, 2016
    Posts:
    1
    I am wondering if anyone knows how to set up Actions so that they require button combinations from a Gamepad. I am aware you can use "Button with one modifier" to detect when two buttons are pressed, but I set up a simple one and it isn't working right.

    I set up one action as "action button", when you press this, something happens in game. Then a second action as "cancel button", when you press this, something different happens in game. And finally, a third action which requires both of the previous buttons to be pressed so "action button + cancel button", and something different to the "action" or "cancel" buttons should happen. So three different things happen in total.

    It doesn't work though, so what's happening right now is the single button actions work perfect. But when I try to do "action + cancel" the effect of the single buttons happens as well as the "action + cancel" effects. So there's two effects happening at once, sometimes three..

    Is this working as intended or am I not using the Input System properly? At the moment, I plan to add a very short timer to catch if the player presses two buttons at once as an input, but I just wanted to make sure there isn't already a way to handle this scenario before I go and make stuff up.

    TLDR: How would one go about setting up "button combos" using the Input System. The use-case is for melee attacks similar to Monster Hunter combo sequences. For example B -> B -> X + B, where X + B produces a specific effect without also causing the effect produced by a single B input.
     
    hughperkins likes this.
  2. Yes: manually code it.

    Currently what you described is the expected behavior. Combos work but don't stop firing the single button actions.
    In theory the InputSystem team is working on it, but they went silent for too long.

    So if you want combos, code it, if you're lucky, Unity will release a better solution in the mean time.
     
  3. kpdotin

    kpdotin

    Joined:
    Feb 4, 2023
    Posts:
    1
    Any updates in 2023? Because I can't find any manual or video about combo mechanic using new input system