- [A] - move left.
- [D] - move right.
- [Space] - jump.
Your ground objects and your character should have colliders and RigidBody2D component (RigidBody2d should have a body type "Dynamic").
Set the same layer to every ground object. This is needed to let the script know when the charecter is on the floor so it can jump.
Add a child object to your character object which will check if the character is on the ground.
And place it under your character.
Drag and drop your script to your character components.
Set the script variables to your values.
P.S. Jump sprite is optional (Look code).