Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Tilemap Collider 2D component reference

Explore the properties you can use to generate collision shapes for the tiles on a tilemap.
Read time 4 minutesLast updated 12 days ago

Explore the properties you can use to generate collision shapes for the tiles on a tilemap. For more information, refer to Enable collision detection for tiles.

Properties

Property

Description

Max Tile Change CountSets the maximum number of changes you can make in a tilemap before Unity regenerates all the collision shapes. The default value is 1000. Decrease this value to regenerate all the collision shapes more often, which can improve performance if you change lots of tiles frequently.
Extrusion FactorSets how far to extend the collision shape of each tile, in units. This property is available only if you attach a Composite Collider 2D component to the same GameObject, and set Composite Operation to an option other than None. Use this property to bring collision shapes to within the Vertex Distance property of the Composite Collider 2D component, so the component combines the shapes.
Use Delaunay MeshEnables Unity using a Delaunay triangulation algorithm to generate the collision shapes. Enabling this property can improve collision shapes for tiles with complex shapes, but can reduce performance.
MaterialSets the 2D physics material that determines the behavior of collisions, such as friction and bounce.
Is TriggerEnables the shape going through other shapes without generating a collision response. Instead, the shape generates a trigger event when another shape overlaps.
Used by EffectorAllows an Effector 2D component attached to the same GameObject to affect collisions.
Composite OperationIf a Composite Collider 2D component is attached to the same GameObject, sets how the component combines the collision shapes of the tiles. The options are:
  • None: Doesn't combine the collision shapes.
  • Merge: Combines the collision shapes.
  • Intersect: Creates a collision shape from the overlapping area of the collision shapes.
  • Difference: Creates a collision shape from the non-overlapping area of the collision shapes.
  • Flip: Creates a collision shape from the non-overlapping area of the collision shapes, but also includes the area outside the collision shapes.
Note: When you set the value to an option other than None, the Composite Collider 2D component controls the following properties: Material, Is Trigger, and Used By Effector.
Composite OrderSets when Unity calculates the combined collision shapes, relative to other Composite Collider 2D components. Unity calculates in numerical order, so it calculates colliders with lower values first. This property is available only if you set Composite Operation to a value other than None.
OffsetOffsets the position of the collision shapes from the tile positions, in units.

Layer Overrides

Property

Description

Layer Override PrioritySets the decision priority when this collision shape collides with another collision shape. Refer to
Collider2D-layerOverridePriority
.
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
.
Contract 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
.

Info

Property

Sub-property

Description

Attached BodyN/AThe Rigidbody 2D component attached to the same GameObject as this component.
Shape CountN/AThe number of individual shapes in the collider.
MaterialN/AThe properties of the 2D physics material set in Material.
N/AFrictionThe friction value of the 2D physics material.
N/ABouncinessThe bounciness value of the 2D physics material.
N/AFriction CombineThe friction combine setting of the 2D physics material.
N/ABounciness CombineThe bounce combine setting of the 2D physics material.
BoundsN/AThe boundary of the collider.
N/ACenterThe center of the collider in world space.
N/AExtentsThe size of the collider in world space.
For more information about the properties of a 2D physics material, refer to Physics Material 2D reference.

Additional resources