Search Unity

"Hold" interaction seems broken on 0.2.8

Discussion in 'Input System' started by MaxCantor, May 1, 2019.

  1. MaxCantor

    MaxCantor

    Joined:
    Jun 12, 2017
    Posts:
    1
    After debugging our project and finding that the
    performed
    phase is reported immediately after the
    started
    phase, we broke out a smaller project for testing and got the same behavior. Here is our minimal bootstrap code:

    Code (CSharp):
    1.  
    2.     void Start()
    3.     {
    4.         var controls = new PlayerInputActions();
    5.         controls.Default.Enable();
    6.         controls.Default.SetCallbacks(this);
    7.     }
    8.  
    The relevant snippet from the auto-generated CS file's JSON:

    Code (Javascript):
    1.  
    2.                 {
    3.                     ""name"": ""Charge Attack"",
    4.                     ""id"": ""a8d29c33-4c7b-4122-a595-28728fcab3e1"",
    5.                     ""expectedControlLayout"": ""Button"",
    6.                     ""continuous"": false,
    7.                     ""passThrough"": false,
    8.                     ""initialStateCheck"": false,
    9.                     ""processors"": """",
    10.                     ""interactions"": ""Hold(duration=3)"",
    11.                     ""bindings"": []
    12.                 },
    13.  
    And our handler:

    Code (CSharp):
    1.  
    2. public void OnChargeAttack(InputAction.CallbackContext context)
    3.     {
    4.         switch (context.phase)
    5.         {
    6.             case InputActionPhase.Disabled:
    7.                 break;
    8.             case InputActionPhase.Waiting:
    9.                 Debug.Log("Waiting for charge attack.");
    10.                 break;
    11.             case InputActionPhase.Started:
    12.                 Debug.Log("Started charge attack.");
    13.                 break;
    14.             case InputActionPhase.Performed:
    15.                 Debug.Log("Completed charge attack.");
    16.                 break;
    17.             case InputActionPhase.Cancelled:
    18.                 break;
    19.         }
    20.     }
    21.  
    The debug log reads as follows after pressing and immediately releasing the button:

    Started charge attack.
    Completed charge attack.

    We've tried several different configurations, including putting the "Hold" interaction on the Action itself as opposed to the control binding; and we have tried this with "Continuous" checked and unchecked. The behavior seems identical either way.

    According to this post, a very similar-looking bug (if not the very same bug) was fixed in 0.2.6, but I'm seeing this behavior on multiple 0.2.8 projects.
     
    Last edited: May 1, 2019
  2. KitChristopher

    KitChristopher

    Joined:
    Mar 4, 2019
    Posts:
    6
    It seems a few things broke on the latest update. I noticed that the Press "Release Only" has also broken and acts as a "Press and Release".
     
  3. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Could you submit bugs with repro cases for these (and post bug links here)?
     
  4. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Actually, we have identified and fixed the issue with the hold interactions.