Simple 2D Player Movement in Unity

Valdarix Games
7 min readApr 4, 2021
This is our goal

Getting Started

Let’s be honest, the first thing we want to do when we start making a game is to get our avatar moving around the screen. So let’s take a quick look at how to accomplish this task. Luckily Unity provides us with a built-in tool so we don’t have to recreate the wheel when it comes to movement input.

The first thing we need to have a look at is the Input Manager. We can access the input manager by clicking Edit > Project Settings and looking at the menu on the left side of the project manager popup.

Inside the Input Manager, we find the Axes dropdown. Here we can see what keys Unity has set up for us to perform various player actions. We are only interested in Horizontal and Vertical at the moment but don’t worry, we will be revisiting this screen in future articles. Make note of the capitalization, this will be important later.

If we expand Horizontal and Vertical we will see that we can use WASD to move in traditional ways. So let’s go ahead and set this up.

Player Script

--

--

Valdarix Games
Valdarix Games

Written by Valdarix Games

Turning my passion for video games and software development experience into a focus on video game development.

No responses yet

What are your thoughts?