1. Setup
Before importing the asset, you have to switch to Unity’s new “Input System” package.
You do that by going into the Package Manager and installing “Input System” from the Unity Registry.

Once you’ve done that, go ahead and enable it from the Player Settings, following the images below:




Once that’s out of the way, import “SimpleInput.unitypackage” into your project:

2. How to use
The first thing you should do is to drag the “InputHandler.prefab” object from the “Put in scene” folder into your scene hierarchy.

If Debug Mode
is true, upon pressing a key, you’ll fire up a Debug.Log
message stating what that key is.
“JoystickInput.cs” is disabled by default, which means that you won’t be able to access it until you enable it.
If both “KeyboardInput.cs” and “JoystickInput.cs” are enabled at the same time, you can use them at the same time. If you wish to use only one, you’ve got to enable it.
You can do that manually by ticking the boxes of your desired input method, or you can make use of “ChangeMode.cs”.

You can call
ChangeMode.switchTo("Joystick");
or
ChangeMode.switchTo("Keyboard");
from anywhere in your scene, either through code or a button:

3.Syntax
!!! KEEP IN MIND !!!
Button taps on joystick start with the keyword "down"
ex: JoystickInput.downRB,
but on keyboard, the keyword "down" is at the end
ex: JoystickInput.SPACEdown.
I did my best to keep the syntax as close to the default Input class as possible.
3.1 Joystick
To get data about the joystick input, just call the JoystickInput class and access the static bool you need.

BUTTONS:
All of the buttons from the D-Pad to the XABY keys to RB & LB have a bool value that is true whenever the buttons are being held, there is also a bool that is true only during the first frame when you press them.
if(JoysticInput.RB)
Gun.Shoot();
/*Gun.Shoot() is called during each frame, where the 'RB' button is being held!*/
================================================
if(JoystickInput.Adown)
Player.Jump();
/*Player.Jump() gets called only once, upon the player pressing the A button!*/
NON-BUTTONS:
RT and LT represent the triggers, they return a float value, indicating how far the trigger has been pushed
Example:
Car.GasPedal(JoystickInput.RT);
//Pushing the Trigger further feeds more gas to the car
LeftStick & RightStick return a Vector2 of the sticks’ direction along the X and Y axis.
Example:
rb.AddForce(JoystickInput.LeftStick);
/*Force gets added to a rigidbody in whatever direction the left stick is pointing at*/
3.2 KEYBOARD & MOUSE
The syntax for getting keyboard input is similar to the one for the joystick. call the KeyboardInput class and access the static bool you need.

if(KeyboardInput.SPACEdown)
Player.Jump();
/*Player.Jump() gets called only once, upon the player pressing spacebar*/
==================================================
if(KeyboardInput.D)
Player.Move("toRight");
/*Player.Move("toRight") is called during each frame, where the 'D' key is being held!*/
Interactions with the mouse are also contained in the KeyboardInput class:
The Vector2 KeyboardInput.mousePos
represents the position of the mouse in reference to the window resolution.
You can also get mouse button presses:
KeyboardInput.LMB <- true while left mouse button is being held.
KeyboardInput.RMBdown <- true during the first frame, when the right mouse button has been pressed.
KeyboardInput.MMB <- true while middle mouse button(scroll wheel) is being held.
Scrolling the mouse wheel is represented by
int KeyboardInput.mouseScroll
/*
*returns 1 when you're scrolling up,
*0 when you're not scrolling
*and -1 when you're scrolling down.
*/