Link Search Menu Expand Document

Tilemaps

A Tilemap is a way to build a static background environment. Tilemaps can have collision as well.

Creating a Tilemap

To create a tilemap, right-click on the SampleScene and select GameObject > 2D Object > Tilemap > Rectangular.

Tilemap Create

In the Inspector, you will need to add a “Tilemap Collider 2D” (1.). Then, click on the “Open Tile Palette” button (2.).

Tilemap Collider

Creating a Tile Palette

A Tile Palette is a way to store the tiles that you will use to create your background.

  1. Select “Create New Palette” and a dropdown will show.
  2. Name it “Ground Palette”.
  3. Click “Create”.

Tilemap Create Palette

A dialog will open prompting you to select what folder you want to put the palette into and for our small project, just hit “Select Folder”. In larger projects, you’ll want to organize Prefabs, Tilemaps, etc. in folders.

Tilemap Select Folder

Tagging the Tilemap as Ground

Later, we will be checking if our Player is colliding with the ground. To do this, we need to add a Tag (label) to the Tilemap. Select the Tilemap from the Hierarchy and add a “Ground” Tag.

Tilemap Tag Add

Tilemap Tag Ground

After pressing “Save” above, you will be redirected to the Inspector for the Tilemap. Select “Ground” from the Tag dropdown menu.

Tilemap Tag Ground