Unity’s New Input System: Switching Action Maps

Marcus Cohee
2 min readAug 12, 2022


Hello all!

Today, I will be going over how to switch between action maps using C#!

I press T to enter and exit the driving action map

Setting Up the Action Maps

Action maps are used when you want to change the inputs for different tasks. My case is switching from Player to Driving modes.

Player Action Map

I only set one action for the player to demonstrate the switch when I press T.

Driving Action Map

In the driving action map, I set the actions to follow Vector 2 and I added a way to switch back to the Player action map.

Don’t forget to generate a C# class of this InputAction asset in the Inspector.

Switching Action Maps in Script

Get a reference to the InputActions asset>Enable the Player action map>then setup what the EnterCar action does.

So, when you hit T in Player mode, I made a log saying that I entered the car>Disabled Player>Enabled Driving>Then set what happens when I press T again while in Driving mode.

Simple Driving Code

When in driving mode and press WASD, it gives a value. I just read the Vector2 values and set them to their corresponding axis.

To move forward in 3D space, you either use x or z. Using y would just raise the player.

Then to rotate the car, I set left and right to rotate on the y axis.

That was how to switch action maps using code!

Next up, setting up different taping and holding actions!

See you then!



Marcus Cohee

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