Simple 2d Movement in Unity

We’re going to be using the Old Input system for this. I find it convenient for quick prototyping.

first, We’re going to start out by serializing a speed variable that we can adjust from the editor.

Easy enough. Now, for the meat and potatoes. We need to access the vertical and horizontal input so we can use that in our movement calculations.

We’ll put this in update for now, but it will be moved to its own method later on.

Now for the movement calculations.

The Translate() method is the main player here. We move based on the input and speed and the movement is smoothed out by using Time.deltaTime. Super easy!

This is a caveman method. There are definitely more advanced ways of doing this using the new Input System, but the core fundamentals are still there.



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
Chandler Lane

Chandler Lane

Unity Developer - Professional Actor