Objective: To understand what an Action Map is and how it functions in Unity’s New Input System.
So far we have seen how to download, install and create our first Input Action Asset in Unity’s New Input System. It is time to take the next logical step and dive a bit deeper into understanding what an Action Map is and how to set one up.
What is an Action Map
Simply speaking, an Action Map is a collection of Actions for some specific functionality. You can have many Action Maps and it’s purpose is to help provide greater functionality to existing keys/buttons (depending on the state), whilst allowing for more complex mapping behaviours to be built, but still providing the end user with a simple to use experience.
E.g. We could have multiple Action Maps for an FPS or 3rd person shooting game where the player has different states, but still utilising the same buttons. Let’s look at an Xbox Controller as an example:
- If the player is running around with their gun out, you would normally use the left trigger to zoom in and the right trigger to shoot a gun. Alternatively;
- If the player was in a car, the same buttons have different functionality, like reversing and accelerating.
- If the player was swimming, the buttons could be then mapped to a dive and climb functionality.
We don’t need our choice of input to have 100 buttons all doing different things, we can isolate different button behaviours into Action Maps which are based on states.
There can also only ever be 1 Action Map active.
How to Create a New Action Map
By simply pressing on the ‘+’ symbol under Action Maps, you will be able to quickly add your new Action Map, naming it what you like. Given the above example we would likely label them: Swimming, driving and running etc.
Next up we are going to look at the second section in this window which looks after our Actions!