Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Composite Collider 2D component reference

Refer to the Composite Collider 2D properties to merge other collider shapes into a single collider.
Read time 3 minutesLast updated 19 days ago

The Composite Collider 2D component is a Collider 2D that interacts with the 2D physics system. Unlike most colliders, it doesn't have an inherent shape. Instead, it merges the shapes of any Box Collider 2D, Polygon Collider 2D, Circle Collider 2D or Capsule Collider 2D that it's set to use. The Composite Collider 2D component uses the vertices (geometry) from any of these colliders, and merges them together into new geometry controlled by the Composite Collider 2D component itself.

Property

Function

MaterialSelect the Physics Material 2D that determines properties of collisions, such as friction and bounce.
Is TriggerEnable this if you want the collider to behave as a trigger. The physics system ignores the collider when you enable this option.
Used By EffectorEnable this if you want an attached Effector 2D component to use the collider.
OffsetSet the local offset values of the collider geometry.
Geometry TypeSelect the type of geometry to merge the vertices of the selected colliders into. Select either Outlines or Polygons from the dropdown menu.
    OutlinesSelect this to produce a collider with hollow outlines, identical to an Edge Collider 2D.
    PolygonsSelect this to produce a collider with solid polygons, identical to a Polygon Collider 2D.
Use Delaunay MeshEnables Unity using a Delaunay triangulation algorithm to generate the collision shapes. Enabling this property can improve collision shapes for complex shapes, but can reduce performance.
Generation TypeSelect the geometry generation method used when either the Composite Collider 2D component changes, or when any of the colliders composing it change.
    SynchronousSelect this to have Unity immediately generate new geometry when making a change to the Composite Collider 2D component or to any of the colliders composing it.
    ManualSelect this to have Unity generate geometry only when you request it. To request generation, either call the CompositeCollider2D.GenerateGeometry scripting API, or select Regenerate Geometry in the Inspector window.
Vertex DistanceSet a value for the minimum spacing allowed for any vertices gathered from the combined colliders. Unity removes any vertex closer than this limit. This allows control over the effective resolution of the vertex compositing.
Offset DistanceSet the value to offset vertices when compositing multiple physics shapes. Unity combines any vertices between physics shapes within this distance value. Note: It's recommended to not set this value higher than 1% of the Sprite's length, as this can result in loss of detail when too many vertices combine together.
Layer OverridesExpand for the layer override settings.
    Layer Override PrioritySets the decision priority when this collision shape collides with another collision shape. Refer to its API documentation for more information.
    Include LayersSets the layers this collision shape collides with. Refer to
Collider2D-includeLayers
.
    Exclude LayersSets the layers this collision shape doesn't collide with. Refer to
Collider2D-excludeLayers
.
    Force Send LayersSets the layers this collision shape sends forces to during collisions. Refer to
Collider2D-forceSendLayers
.
    Force Receive LayersSets the layers this collision shape can receive forces from during collisions. Refer to
Collider2D-forceReceiveLayers
.
    Contact Capture LayersSets the layers of other Collider 2D components to capture during collisions. Refer to
Collider2D-contactCaptureLayers
.
    Callback LayersSets the layers to report collisions or triggers with. Refer to
Collider2D-callbackLayers
.

Additional resources