Creating colliding tilemaps

Understanding how colliders work within the tilemap system

Simon Truong
2 min readNov 12, 2021

--

The final thing to learn about Tilemapping is how to make colliders within the grid system. Since we are using 2D objects that is within a grid, the regular method of adding a 2D collider won’t work.

Objective: Learn the several components required to make colliders work on Tilemaps.

Creating the Colliders:

The first component which we need to add to convert our 2D image into a collidable object is adding the “Tilemap Collider 2D”. This component allows the selected grid to highlight all the active tiles and apply an collider on it.

Unfortunately this means that every single tile active, including the tiles which is not reachable by the player will also have a collider around it. This isn’t great for game optimization. To fix this we will need to add in a composite collider 2D component. This will automatically add an Rigidbody 2D component to the selected grid along with an composite collider. Make sure within the Rigidbody we have “Static” as the selected Body Type. Finally back in the Tilemap Collider 2D, check the “Used by Composite” as active.

Once you have the composite check box active, you will see that Unity will automatically convert the grid to just outline only.

--

--

Simon Truong

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.