Enable collision detection for tiles
Tilemap Collider 2D component reference
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 Count |
Sets 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 Factor |
Sets 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 Mesh |
Enables 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. |
| Material |
Sets the 2D physics material that determines the behavior of collisions, such as friction and bounce. |
| Is Trigger |
Enables the shape going through other shapes without generating a collision response. Instead, the shape generates a trigger event when another shape overlaps. |
| Used by Effector |
Allows an Effector 2D component attached to the same GameObject to affect collisions. |
|
Composite Operation
|
If 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 Order |
Sets 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. |
| Offset |
Offsets the position of the collision shapes from the tile positions, in units. |
Layer Overrides
Info
| Property |
Sub-property |
Description |
| Attached Body |
N/A |
The Rigidbody 2D component attached to the same GameObject as this component. |
| Shape Count |
N/A |
The number of individual shapes in the collider. |
| Material |
N/A |
The properties of the 2D physics material set in Material. |
| N/A |
Friction |
The friction value of the 2D physics material. |
| N/A |
Bounciness |
The bounciness value of the 2D physics material. |
| N/A |
Friction Combine |
The friction combine setting of the 2D physics material. |
| N/A |
Bounciness Combine |
The bounce combine setting of the 2D physics material. |
| Bounds |
N/A |
The boundary of the collider. |
| N/A |
Center |
The center of the collider in world space. |
| N/A |
Extents |
The 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
Enable collision detection for tiles