Quick answer: Set Geometry Type to Outlines on the CompositeCollider2D for cleaner edges. Bump Edge Radius to 0.02–0.05 to round micro-zigzags. Use a Capsule character collider so the character does not catch.
Here is how to fix Unity Tilemap CompositeCollider2D producing jagged outlines that snag characters or look broken in debug. The composite stitches per-tile shapes; small numerical drift at boundaries produces unwanted micro-edges. The settings to clean it up are subtle.
The Symptom
Tilemap with TilemapCollider2D + CompositeCollider2D shows jagged or zig-zag outlines along straight tile rows. Character snags or stops on these.
What Causes This
Polygon geometry artifacts. Polygon mode internally triangulates; numerical jitter near boundaries produces visible micro-edges.
Per-tile collision misalignment. If tile collision shapes are slightly off-pixel-grid, composite output reflects that.
No edge radius. Default 0 edge radius leaves sharp corners that snag capsules.
The Fix
Step 1: Switch to Outlines geometry.
// CompositeCollider2D inspector
Geometry Type: Outlines
Generation Type: Manual // or Synchronous for runtime updates
Edge Radius: 0.05
Outlines walks the perimeter; smoother result for tile-based worlds.
Step 2: Verify per-tile shapes. Open the TileSet. For each solid tile, ensure the collision shape exactly fills the tile (corners at tile bounds). Slight offsets compound at boundaries.
Step 3: Use Capsule for character collider. Round bottom rolls over micro-edges instead of catching.
Step 4: Snap character physics positions.
void FixedUpdate()
{
Vector3 p = transform.position;
p.x = Mathf.Round(p.x * 100f) / 100f; // 1cm grid
p.y = Mathf.Round(p.y * 100f) / 100f;
transform.position = p;
}
Snapping character to a fine grid avoids float-position-dependent snagging.
Step 5: For runtime tile changes, regenerate composite.
composite.GenerateGeometry();
Call after editing the Tilemap programmatically; otherwise the composite uses stale geometry.
“Outlines geometry. Edge radius. Capsule character. Tilemap collisions stop snagging.”
Related Issues
For 2D ghost collisions in Godot, see CharacterBody2D Ghost. For Physics2D effector, see Effector Not Applying.
Outlines mode. Edge radius up. Capsule on character. Edges run smooth.