There are many different ways to make a “Character Controller” in Unity. You can hard code everything that you are wanting, use a rigid body to control your character through Unity’s built-in physics, or you could do what we’re going to be doing today and build out your player’s character controller using the actual component in Unity called the “Character Controller”.
To do this you will need to start by creating a “Primitive Object” such as a cube or capsule. Then add the “Character Controller” component to it. The character controller comes with a built-in collider, so you can delete the default collider that is provided with the object.
Next, create a new C# script and add it to your new object.
This script will move the character controller horizontally and allow for jumping.
That’s it. You should now have a fully functioning character controller fit for a 2D side scroller!