Version: Unity 6.4 Beta (6000.4)
Language : English
Isometric brush shortcut Reference
Tilemap component reference

Enable collision detection for tiles

To enable collisionA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
See in Glossary
detection for tilesA simple class that allows a sprite to be rendered on a Tilemap. More info
See in Glossary
, add a TilemapA GameObject that allows you to quickly create 2D levels using tiles and a grid overlay. More info
See in Glossary
ColliderAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
See in Glossary
2D component to the tilemap.

The Tilemap Collider 2D component automatically generates collider shapes for each tile in the tilemap, so that GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
with a Collider2D component collide with the tiles.

You can choose which tiles to enable collision for.

Add a Tilemap Collider 2D component

To add the component to a tilemap, follow these steps:

  1. Select an existing tilemap GameObject in your project, or create a tilemap.
  2. In the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary
    window, select Add Component.
  3. Search for and add the Tilemap Collider 2D component from the list.

The SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
view displays the collider shapes as green outlines over the tilemap.

To make another GameObject collide with the tiles, refer to Collider 2D.

Disable collisions for a tile

Follow these steps:

  1. In the Project window, select a tile asset.
  2. Set Collider Type to None.

Create a custom collider shape

To change the shape that a tile uses to register a collision, use the Custom Physics Shape window in the SpriteA 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info
See in Glossary
Editor.

  1. In the Project window, select a tile asset.
  2. Set the Collider Type to Sprite.
  3. Select Sprite Editor.
  4. In the Sprite Editor window, in the dropdown at the top-left, select Custom Physics Shape.

For more information about editing the shape, refer to Custom Physics Shape window.

Reduce the number of collider shapes

To improve the performance of a tilemap with many collider shapes, add a Composite Collider 2D component. Unity merges the collider shapes of neighboring tiles together, which reduces how much Unity needs to calculate during a physics update.

Follow these steps:

  1. Select a tilemap with a Tilemap Collider 2D component.
  2. In the Inspector window, select Add Component.
  3. Search for and add the Composite Collider 2D component from the list.

For more information, refer to Composite Collider 2D component reference.

To further configure performance and collider behavior, use the TilemapCollider2D API.

Update collider shapes manually via API

By default, when you add or remove tiles, the Tilemap Collider 2D updates shapes during LateUpdate and batches multiple changes together for performance. To force immediate updates, follow these steps:

  1. Call Tilemaps.TilemapCollider2D.ProcessTilemapChanges to process changes immediately.
  2. Check Tilemaps.TilemapCollider2D-hasTilemapChanges to determine if processing is required.

For more information, refer to the TilemapCollider2D API.

Additional resources

Isometric brush shortcut Reference
Tilemap component reference