When you attach a colliderAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
See in Glossary 2D component to a GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary, the collider 2D defines which area of the GameObject has collisionA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
See in Glossary and can interact with other colliders in the sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary. The collider 2D is invisible, and it’s shape is about the same shape as the GameObject for more accurate collisions. You can adjust a collider’s shape and other properties in its InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary window properties.
Colliders for 2D GameObjects all have names ending with 2D. You can’t use 3D GameObjects with 2D colliders, or 2D GameObjects with 3D colliders.
You can use the following types of collider 2Ds with Rigidbody 2D:
Topic | Description |
---|---|
Circle Collider 2D component reference | Refer to the Circle Collider 2D component properties to create circular colliders. |
Box Collider 2D component reference | Refer to the Box ColliderA cube-shaped collider component that handles collisions for GameObjects like dice and ice cubes. More info See in Glossary 2D component properties to create rectangular or square colliders. |
Polygon Collider 2D component reference | Refer to the Polygon Collider 2D component properties to create freeform colliders. |
Edge Collider 2D component reference | Refer to the Edge Collider 2D component properties to create freeform and open path collision areas. |
Capsule Collider 2D component reference | Refer to the Capsule ColliderA capsule-shaped collider component that handles collisions for GameObjects like barrels and character limbs. More info See in Glossary 2D component properties to create cylindrical shaped collision areas with round ends. |
Composite Collider 2D component reference | Refer to the Composite Collider 2D properties to merge other collider shapes into a single collider. |
Custom Collider 2D component reference | Refer to the Custom Collider 2D properties to create customizable collision geometry. |