Unity: Handling Input With the Input System
The Input System is an incredibly robust solution to handling input between multiple devices. There are a quite a few more steps to using the Input System when compared to the Input Manager which I will step through here. These steps are demonstrated using the 2020 version, although they are the same in the 2021 version as well.
The Unity Input System allows you to access the input through multiple methods. Here, I am going to demonstrate one way to use the Input System through C# commands and a custom input poller.
The Steps
- Get the Input System package installed
- Create an Input Action Asset
- Add a Player Input component to a game object
- Poll the Input System with our custom code
Installing the input system package
To do this you navigate to the Window drop down, then to the Package Manager option.

From there we need to navigate to the Unity Registry. This is where the Unity built packages are held.

All we need to do now is find the Input System package and install it. Unity will then prompt us to restart the Unity engine. Click Yes and allow Unity to restart.


That's it! You now have successfully installed the Input System.
Creating the Input Action Asset and Adding the Player Input Component
These two steps can be done in any order, however, if you don’t like starting from scratch every time then Unity allows you to create a default Input Action Asset from the Player Input system.
To demonstrate this we are going to add the Player Input component to a GameObject in our scene.


Before we go any further, be sure to change the Behavior from “Send Messages” to “Invoke C# Events”

Now we have both the Player Input component and an Input Action Asset created!
Polling the Input System with our custom code
This next step will allow us to read the input from the Input Action Asset and the Player Input component. To follow along directly please keep all the names the same and use the default Input Action Asset.
Creating the Script
We are going to create a new script called InputHandler .


To access the Input System you have to use the namespace UnityEngine.InputSystem; at the top of the script.
The logic of this script is to create public variables that other classes can utilize while also creating private variables for accessing the Input Action Asset through the Player Input component. the private variables will be of type InputAction.

Now we need to just hook up the references to the scripts and we are good to go!
First we will assign the InputHandler reference to the PlayerInput component. Then we will allow the Player script to access the InputHandler script

We are going to add a reference to the Player class to allow it to read the InputHandler, then assign the move input to our Update script.

Make sure you assign the reference for the Player class to access the InputHandler script!

Hit Play and test it out!

These are definitely more steps and moving parts than the Input Manager solution, however, with these more steps comes a much more robust solution when working with controllers and switching between input device types.
The Author
If you would like to support me so that I can continue putting out articles and videos please consider becoming a member. If you would like to give a more direct donation, feel free to buy me a coffee Ko-Fi/MikeQ. If you have any questions, complaints, or funny jokes, be sure to throw them in the comments.
Want to know more about me? Feel free to checkout my latest interview with BadVR or connect with me on LinkedIn.






