
CharacterBody2D, RigidBody2D and StaticBody2D Classes in Godot Engine all must have Collision Shapes to work properly. They all to some extent are affected by Physics Engine of the editor.
These bodies inherit from PhysicsBody2D Class which iself inherits from CollisionObject2D. Check out this screenshot:

So, when we add any of these physics bodies to our game it must have a collision shape around it to be able to push, bounce or make other physical interactions with other body type objects. In this tutorial I'll explain how to add shapes to the objects in the editor and how to turn on their visibility when we run our game in Godot Editor.
CONTENT:
Assuming you have a scene with any of the body type mentioned or Area2D object a the top of your scene tree and you want to a CollisionShape2D object as its child, then set up the proper shape for the body. Now, add a new child to your scene and choose CollsionShape2D in the list of nodes, then click on it in the Scene dock, go to Inspector dock and add a new shape by choosing one of them in the list of the Shape's property value field.

As you can see, I have CapsuleShape which can be used for shooting bullets, for example or other elliptically shaped objects. Among others there's also RectangleShape2D and CircleShape2D. These two are probably used the most often.
When we run our game in Godot Editor it doesn't show collision shapes around the objects because by default this option is set to false. There are 2 ways how you can change it:
Click on Debug category in Godot's Main Menu (at the top). In the drop down Debug category items find Visible Collision Shapes, and check the checkbox next to it. That's it. Now, when you run your game in the editor you'll see colored collision shapes around the objects in the game.
To turn on the visibility of the shapes we need to access the SceneTree object because this property belongs to the scene tree class. This is the list of properties existing in that class:

In your Main Scene gdscript file in _ready() method write this line of code: get_tree().debug_collisions_hint = true
This will have the same effect as making shapes visible with the main menu. Check out this demo:

Here I have all 3 types of physics bodies. My player is CharacterBody2D, the ball is RigidBody2D and the rocks are StaticBody2D objects. As you can see, all of them have collision shapes and they are all visible in the editor.
By the way, if you want to learn more about different Classes in Godot Engine take a look at this tutorial about AnimatedSprite2D.
If you find this tutorial useful, follow me on Instagram for more tips and learning materials.