CompositeCollider2D
class in UnityEngine · UnityEngine.Physics2DModule · inherits from Collider2D
One collider made of the colliders on its Rigidbody2D that are Collider2D.usedByComposite: their shapes combine in composite order, each by its operation on the ones before (the first as it is; Merge adds, Intersect keeps the overlap, Difference cuts, Flip toggles; touching and overlapping shapes join into one outline), and the merged colliders no longer collide themselves; contacts and queries report the composite. Outlines are closed loops of edges (bodies slide across the joins between tiles); Polygons fill them, holes left open.
Properties 8
float edgeRadius { get; set; }Outlines: the edges' radius.
GenerationType generationType { get; set; }GeometryType geometryType { get; set; }float offsetDistance { get; set; }Gaps narrower than twice this close, and corners are cut by it (grown, shrunk twice as far, grown again; negative: shrunk first). Changes under a millionth are ignored, as in Unity.
int pathCount { get; }int pointCount { get; }bool useDelaunayMesh { get; set; }float vertexDistance { get; set; }Points closer than this to the previous one are dropped.
Methods 4
void GenerateGeometry()Rebuilds the geometry now (Manual generation rebuilds only here).
int GetCompositedColliders(List<Collider2D> colliders)The colliders merged into this one.
int GetPath(int index, Vector2[] points)int GetPath(int index, List<Vector2> points)Path index's points in local space (outer outlines counter-clockwise first, then holes); the count copied.
int GetPathPointCount(int index)Checked against Unity
Conformance scenarios that exercise it, recorded in Unity and compared event by event.