New Input System How to get Left Stick Axis

Hi, I am developing a mobile game and trying to add gamepad support to it, I’ve set up all the buttons but couldn’t figure out how to set up movement (with left stick of gamepad).


My game is a 2d game, so only movement is to the left and right, but the problem is; I don’t know how to get the left stick/left axis and left stick/right axis, I want to get those axis and their min/max values so I can check according to them to move the character to the left or right.


If anyone can help me about it I’ll be so glad, thanks in advance!

Here is a try.

Code to put in Update() or FixedUpdate()

Gamepad gamepad = Gamepad.current;
if (gamepad != null)
{
    Vector2 stickL = gamepad.leftStick.ReadValue();
    //stickL.x will be -1.0..1.0 (for full left to full right)
    //stickL.y will be -1.0..1.0 (for full down to full up)
}