Collider components not only allow GameObjects to be recognized by Unity's physics system, but they also make interactions and collisions possible. Think of colliders as invisible force fields that surround GameObjects; they can be passed through or bumped into depending on their settings, and they come with a host of methods that fire during different interactions.Â
Unity's physics system works differently for 2D and 3D games, so we will only be covering the 3D topics in this book. If you're interested in making 2D games, refer to the Rigidbody2D component and the list of available 2D colliders.
Take a look at the following screenshot of the Capsule in the Pickup_Prefab object hierarchy:
The green shape around the object is the Capsule Collider, which can be moved and scaled using the Center, Radius, and Height properties. When a primitive is created, the Collider matches the primitive's shape by default; since we created a...