Day 4: One small step for a cube...

today we start writing some code, we start with the movement of the player.
The objective is to move our cube by sending inputs from the keyboard.

To do this, there are several ways, I opted for the most classic one provided by Unity, or the axes already set within its project settings.

Project Settings

We have to create variables to move our player and link them to the axis system provided by Unity

Finally, we need to use the transform functions of our game object, link our new inputs and make sure this code segment is inside the Update or in a method called inside the Update.

I recommend always keeping the code clean so that it is always easy to read.

This is the final version for a simple player movement. I decided to add a variable to make it more readable.

Unity Developer