The Box Collider 2D component will give our character a bounding box that will interact with the world around it. This means that if the character hits another GameObject that also has Collider, we will be able to use code to know about it. This is imperative to the interaction of the character with the game world since without it, we wouldn't have the information needed to do things, such as collect pick-ups, or know when the character hit something dangerous, such as the obstacles.
Just as Rigidbody 2D, the Box Collider 2D component is easy to set up.
With the Character GameObject selected, navigate to the Inspector tab and click on Add Component.
Search for Box Collider 2D and select Box Collider 2D.
By default, Box Collider 2D will fit itself around the image. As our image is 32 x 32 pixels wide and high by default, the collider will match it as it is also 32 x 32 pixels wide and high. To make it fit our character better, change the X value of Size down to 0.22
:
This...