Input System: How to declare interaction types to compare to callback context?

Hi All,

Trying to get the new input system running and its been quite simple so far, however I am trying to deal with two interactions on a single binding which in this case is space bar for jump. If the space is tapped I want the character to jump, if it is held i want the character to use its boosters to fly up. this seems to be simple in the documentation as it shows that you simply look for the interaction type inside the callback context, it shows that you simply check if the interaction is “TapInteraction”. The issue is where do I define what “TapInteraction” is as cannot find anywhere a method that returns the correct thing to compare. Help :slight_smile:

Code that I would think would work is below given the documentation link below (see Interaction):
(Struct InputAction.CallbackContext | Input System | 1.0.2)

public void OnJump(InputAction.CallbackContext jumpInteraction)
{
    if (jumpInteraction.interaction is TapInteraction && jumpInteraction.performed)
    {
        isJumping = true;
    }

    if (jumpInteraction.interaction is HoldInteraction && jumpInteraction.performed)
    {
        isBoosting = true;
    }

    else
    {
        isJumping = false;
        isBoosting = false;
    }
}

I think I had the same problem.
What worked for me was I added:

using UnityEngine.InputSystem.Interactions;

so maybe try that.