Unity’s New Input System: Setup Your Action Maps

Hello all!

Today, I will be going over how to setup your first action map in the new input system!

Input Actions Window

Getting started

First, let’s make a folder dedicated to your inputs. Create your input folder in the project tab, then create a new “Input Actions” asset in the folder. Name it something like “PlayerInputActions”.

Action Maps

Open the new Input Actions asset. That will bring up a new window that looks like the one above. To create a new Action Map, click the plus in the Action Maps tab.

Having multiple action maps in your game can be used to make switching from humanoid movement to vehicle movement schemes easy!

Actions in Action Maps

Actions in this context are saying that if you press a key, then an action will happen.

To make a new action, click the plus sign in the Actions tab. Now assign an action type to it. Here are the three types:

Value: Passes a value when the assigned input is pressed. Can be something like Vector2, that sets a value to up, down, left, right.

Button: When the assigned input is pressed, set its value to 1. If not, is 0.

Pass Through: When the assigned input it pressed, it will add a value. This is unique in that it can never be canceled.

Assigning Input to Actions

When your action is made, right click the action, and select the binding you wish to use. There are 4 types:

Binding: Can only assign one input.

Positive/Negative: Allows two inputs. One has a positive value, and the other has a negative.

Binding With One Modifier: Allows input like Shift(Modifier)+W(Binding) for running.

Binding With Two Modifiers: Allows input like Shift(Modifier1)+CTRL(Modifier2)+Z to turn off UI.

In these bindings, the path is where you add what input you want to assign. A nice thing about this is that it can listen to what input you press. Meaning that after you press the Listen button at the top, then press a button on a controller, that button will show up on the window!

That was setting up your action maps!

Next, we make the inputs do things in code!

See you next time!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Marcus Cohee

Marcus Cohee

I am starting Unity and learning the ropes as I go! Let’s take this journey together!