Introducing the Input System Package
Verification environment
- Windows
-
- Windows 11
- Unity Editor
-
- 2020.3.25f1
About Input System Package
In the early days of Unity, we used the Input Manager as a mechanism for receiving input from users. However, in the environment of diversifying game platforms, the input manager has become outdated. A new mechanism for managing user input has been added: Input Systemu Manager.
As of 2022, both the new "Input System Package" and the "Input Manager" for compatibility are available. If you have an old project, you can use "Input Manager" as it is, I think that it will transition to a new "input system package" in the future, so in a new project Use Input System Package.
This section describes how to set it up.
Installing Input System Packages
As of Unity Editor 2020.3.25f1, Input System packages are managed as packages that are not initially installed. To install the package:
After creating your project and launching the Unity Editor, select Window > Package Manager from the menu.
When the Package Manager screen appears, select "Unity Registry" from the package.
If you scroll down the list on the left, there is "Input System", so select it and click the "Install" button at the bottom right.
When installed, it will be displayed as installed, so close the dialog.
If the following dialog is displayed after installing the package, click the "Yes" button to automatically configure the next "Activate input system package". In this case, the Unity Editor will restart.
This project is using the new input system package but the native platform backends for the new input system are not enabled in the player settngs. This means that no input from native devices will come through.
Do you want to enable the backends? Doing so *RESTART* the editor and will *DISABLE* the old UnityEngine.Input APIs.
Activate the input system package
Since I just installed the package, I have an outdated input manager active at the moment. Switch this to the input system package.
Select Edit > Project Settings from the menu.
When the Project Settings dialog opens, select Player from the left menu.
In the tab located below, select PC, Mac.... Select the Settings tab and expand More Settings in the group at the bottom.
If you scroll down to some extent, you will find an item called "Input processing in use" in the "Settings" category, where you can select "Input System Package (New)". You can activate both for the time being, but it is confusing, so in the case of a new project, it is better to use only the input system package.
After making changes, the following dialog will appear, so click "Apply" to restart the Unity Editor.
That's it, you're done!
About the problem of using the "UnityEngine.InputSystem" namespace in code input resulting in an error
I haven't entered the code at the moment, so it won't be an error,
You may receive an error that the namespace does not exist when trying to use it when UnityEngine.InputSystem
entering code (for example, Visual Studio).
For example, if you create a script before installing the "Input System Package".
This is because the project UnityEngine.InputSystem
does not have a reference to .
To resolve this, do the following:
Select Edit > Preferences from the menu.
Select External Tools from the menu on the left and click the Regenerate project files button.
By doing this, Visual Studio UnityEngine.InputSystem
adds to the reference.
Also, the code is error-free.
Change the acceptance of user input in the UI to an input system package
This field is not relevant if you do not use the Unity UI, such as input fields or dropdowns, and should be ignored.
When you place an input field, dropdown, or so on in a view, a Canvas is automatically created and the UI object is placed there. At the same time, an object called "EventSystem" is created. This is an object that manages what happens when some input is done in the UI.
This EventSystem is initially running with an older input manager. If only the input system package is enabled, the UI will not work as it is, so you need to change to the input system package.
To make changes, first select EventSystem.
Then a warning is displayed in the "Standalone Input Module" in the inspector.
Click the Replace with InputSystemUIInputModule button to replace the Standalone Input Module with the Input System UI Input Module.
The UI on your game should now accept input correctly.