Search Unity

Feedback Discrepancy between Press Interaction Documentation, Unity Tooltips and Actual Behaviour

Discussion in 'Input System' started by ChichoRD, Jul 18, 2022.

  1. ChichoRD

    ChichoRD

    Joined:
    Jul 31, 2020
    Posts:
    19
    Recently, while building a Movement Controller that relies in the new Input System interactions for implementing variable jump height I notice an issue/design bug that occured due to a wrong explanation in the actual unity tooltips of the Input Actions window.

    The problem is that the documentation for using the Press on Press and Release mode interaction states as follows:
    • Started gets called on button press - Normal behaviour for buttons
    • Performed gets called on press and release - Could be a desired behaviour
    • Canceled does not get called - Could be a desired behaviour
    However Unity in the editor made me think, and actually demonstrated too, the following:
    • Started gets called on button press - Normal behaviour for buttons
    • Performed gets called only on press - Here lies my implementation
    • Canceled gets called only on release - Here lies my implementation
    At the end it results that both behaviours are being executing but the documentations (from the editor tooltips and the webpage) differ from each other.
    A reply explaining how Unity Developers of this system intended this interaction to perform would be nice and enlighting. Thanks.
     
  2. andrew_oc

    andrew_oc

    Unity Technologies

    Joined:
    Apr 16, 2021
    Posts:
    77
    ChichoRD likes this.
  3. ChichoRD

    ChichoRD

    Joined:
    Jul 31, 2020
    Posts:
    19
    Thanks for regarding my issue.
    For the moment I have chosen that I want to recieve the callbacks for the Press and Release separated in the two methods I am subscribing to performed and canceled. Hence I added this check to prevent the "cancelation" from happening in performed (Although now I know that is indeed supposed to go there):
    Code (CSharp):
    1.     private void OnJumpPerformed(InputAction.CallbackContext obj)
    2.     {
    3.         if (!obj.ReadValueAsButton()) return;
    4.  
    5.         //Jump Logic
    6.     }
    7.  
    When this is fixed or supposed I decide to use the intended behaviour I guess that I will just do the opposite:
    Code (CSharp):
    1.     private void OnJumpPerformed(InputAction.CallbackContext obj)
    2.     {
    3.         if (obj.ReadValueAsButton())
    4.         {
    5.             //Release Jump Logic
    6.  
    7.            return;
    8.         }
    9.  
    10.         //Jump Logic
    11.     }
    12.  
    Personally I understood more intuitive the other behaviour described, besides it gives an use to the canceled event for buttons and helps to separate code upload_2022-7-19_16-44-12.png
    , but this intended behaviour also makes sense.