Search Unity

Resolved Keep default Stick Interaction despite other interactions

Discussion in 'Input System' started by CashMonkey, Jul 11, 2021.

  1. CashMonkey

    CashMonkey

    Joined:
    Mar 10, 2021
    Posts:
    4
    Greetings forum folks,

    I have an action mapping that reads a Left Stick [Gamepad] as a Pass Through / Vector2.

    The default behavior worked exactly as expected (well done), and I was trying to add a custom interaction that would get performed when the stick quickly moves from rest. From what I understand, it is intentional that any interaction added to a binding is supposed to override the default, but in this case I don't want that.

    If I can use a PressInteraction to force default-like behavior on buttons, is there an equivalent for sticks?
    Or, would the only way to preserve default behavior of a stick be to implement the code found in this PR (NEW: 'Stick' interaction) as a 2nd "custom" interaction?
     
  2. CashMonkey

    CashMonkey

    Joined:
    Mar 10, 2021
    Posts:
    4
    I have to assume that what I want to do is not possible.

    I've worked around it with buffer and timer properties that get set in the classes that use this Action. The main drawback is that it doesn't work with individual control schemes and instead applies to all of them.
     
  3. CashMonkey

    CashMonkey

    Joined:
    Mar 10, 2021
    Posts:
    4
    After revisiting this, I created a fake pass through custom Interaction:
    Code (CSharp):
    1. public class PassThroughInteraction : IInputInteraction
    2. {
    3.     public void Process(ref InputInteractionContext ctx)
    4.     {
    5.         if(ctx.ControlIsActuated())
    6.         {
    7.             ctx.Performed();
    8.         } else
    9.         {
    10.             ctx.Canceled();
    11.         }
    12.     }
    13.  
    14.     public void Reset()
    15.     {
    16.     }
    17. }
    Sometimes it returns that phase is started, but that doesn't influence what I was trying to do.