Input.GetKey equivalent in Unity’s Input System?

I have been looking and reading for multiples hours. Maybe i’m just blind or stupid.

I want to know what is the direct equivalent of Input.GetKey in the Unity Input System

From what I understood and saw, there’s no such option in the Input Action Panel. I just want to know how to detect when an action is being continuously done.

Thank you!

NEVERMIND

I finally found what I needed.

If any of you are wondering about what I did.

Vector2 Direction;

void OnTheNameOfYourAction(InputValue value)
{
Direction = value.Get();
}

This will give you a Vector2 that you can then use in if statements to know if you are going forward, backwards, left or right.

Ex:

if (Direction.x > 0.5)
{
Debug.Log(“RIGHT”);
}

if (Direction.x < -0.5)
{
Debug.Log(“LEFT”);
}

if (Direction.y > 0.5)
{
Debug.Log(“FORWARD”);
}

1 Like