Unity Input System
Unity has introduced a new Input System. It’s available as a package and you can read more about it here: Input System : Installation Guide
By using an ootii Input Source, we can switch from using Unity’s legacy Input Manager to their new Input System. Like with Unity’s legacy Input Manager, we need to setup the new Input System.
- Per Unity instructions, import Unity’s Input System using the Unity Package Manager.
Note: You may get errors when you do this. Ignore them for now.
2. Per Unity instructions, add a ‘Player Input’ component to your scene.
3. Per Unity instructions, create a set of actions for the Player Input. This can be done a couple of ways, but using the Actions Editor is easy.
- Click on the “Create Actions…” button.
- Select where to save the *.inputactions file.
- Set the file in the “Actions” property above.
This is an image of the default Actions Editor:
4. If you see errors, it’s because the Assembly Definition files don’t know about the new Input System yet.
To fix this, open the *.asmdef files and add the Input System. Like this:
I have three *.asmdef files that this needs to be applied to:
Each time you import my assets, you’ll need to do this since I don’t know if you’ve imported Unity’s Input System or not.
5. Replace my Unity Input Source with the new Unity Input System Source.
6. Set the “Player Input” to be the Player Input component you added to the scene earlier. In this case, I put them on the same GameObject.
Ensure the “Move Action” and “Look Action” match the names in the Action Editor above.
7. If you haven’t setup any other ootii specific Actions, you can use the “Options” section to do that automatically (for Mouse & Keyboard).
Simply open the section and press “Create Input Actions”.
If you want to re-write existing actions, check the “Replace Existing Entries” checkbox before pressing the button.
- Use Unity’s Input Actions Editor to add more actions like “Jump”, “Combat Attack”, etc.
The motions you use sometimes have action aliases and you’ll need to enter those into Unity’s Input Action Editor with the keys you want to assign.
2. Every time you import an ootii asset, you’ll need to re-add the Unity.InputSystem reference.
Until the Input System is always part of Unity, we’ll have to do this.
3. Different versions of Unity import Unity’s Input System a little differently. I’ve tested this with Unity 2020.1.7f1. If you have a different experience, please email me.
4. Since my demos are build to support lots of different versions of Unity, some components that are used in Unity 2017 many not be applicable to Unity 2020 with the new Input System. You would remove or change these as needed.
For example, Unity’s “Standalone Input Module” uses Unity’s legacy Input Manager.