Sitemap

2D Vector Composite w/ New Unity Input System

3 min readMay 18, 2025

Objective: Learn how to create an Action Map with multiple key bindings using WASD for player movement.

WASD Movement — Multiple keys Assigned to One Action

If I want my Mech to fly using WASD controls, but the default input only supports a single key or button, I can change this by going to Action Properties → Action Type and setting it to Value.

This unlocks access to different Control Types, allowing for more flexible bindings. For our setup, we’ll set the Control Type to D-Pad.

You also use Value if you don’t want to use a D-pad.

Note: Be sure to click Save Asset to apply the changes.

Now you should be able to add a Up/Down/Left/Right Composite binding.
You’ll notice this action uses a 2D Vector by default. That’s because, according to Unity’s official documentation, a Vector2 is “a composite that represents a 4-way button setup like the D-pad on gamepads” — this is exactly what we need for WASD-style movement.

Once the composite is added, simply type in your bindings, and you’re all set.

Verifying Via Script

If you want to test your input via script, you can learn more about scripting actions here, everything in the following code in thoroughly explained there.

Code Highlights

  • First, we create a reference to the PlayerInputActions class.
    Then, in the Start method, we initialize and enable the input actions.
  • Next, we register the Fly (or movement) action and subscribe to its performed event. This automatically generates the method:
    private void Fly_performed(InputAction.CallbackContext context)
  • This method will execute every time the assigned input is performed.
    For testing, we can use console messages inside the method to confirm that the input is being successfully registered.

Here you can observe the console message being registered as I press the WASD keys.

The values change depending on the cardinal direction you press.

If your inputs are being registered in the console, you can confidently add real movement logic.

I hope this was helpful! Check out my portfolio, currently looking for opportunities in the video game industry!

--

--

Dennisse Pagán Dávila
Dennisse Pagán Dávila

Written by Dennisse Pagán Dávila

Software Engineer that specializes in Game Development. Currently looking for new opportunities. Portfolio: dennissepagan.com

No responses yet