Create a tilemap
Create a tilemapA GameObject that allows you to quickly create 2D levels using tiles and a grid overlay. More info
See in Glossary that you paint your tiles onto, and a parent grid that acts as a layout guide.
To start your tilemap project, you have to create a tilemap asset that the tile assets are placed on. There are multiple types of tilemaps and you begin by selecting the one that best fits your project. The following are the tilemap types available:
- Rectangular
- Hexagonal Point Top
- Hexagonal Flat Top
- Isometric
- Isometric Z as Y
The default tilemap is Rectangular. Refer to the respective pages for Hexagonal and Isometric tilemaps for more information on their specific features and uses.
Prerequisites
Make sure you have the 2D Tilemap Editor package installed. If the package isn’t installed, refer to Package Manager.
Create a new tilemap
Create a tilemap in the Hierarchy window
To create a tilemap asset within the Hierarchy window, follow these steps:
- Right-click on the Hierarchy window and select 2D Object > Tilemap to display the available tilemap types.
- Select a tilemap type, for example Rectangular. Unity creates a new Grid GameObjectThe 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 in the Hierarchy window with a child Tilemap GameObject.
Create a tilemap from the Tile Palette window
To create a tilemap from the Tile Palette window, follow these steps:
- Open the Tile Palette window. From the main menu, select Window > 2D > Tile Palette.
- To create a new tilemap, open the Active Target dropdown, then open the Create New Tilemap submenu.
- Select a tilemap type, for example Rectangular Tilemap.
Create a tilemap from an existing tile palette
To create a tilemap based on an existing tile palette’s settings, follow these steps:
- In the Tile Palette window, select a tile palette from the Active Palette dropdown.
- Open the Active Target dropdown, then open the Create New Tilemap submenu.
- Select From Tile Palette to create a new tilemap with the same settings as the selected tile palette.
Create additional tilemaps on a grid
To create create additional tilemaps on the same grid:
- Right-click on the selected Grid GameObject and open the 2D Object > Tilemap dropdown, then select the type of tilemap you want.
Troubleshooting mismatched cell layouts
When you create a tilemap on an existing Grid GameObject, the tilemap might use a different cell layout to the grid. If this happens, Unity detects the mismatch and displays a warning.
Select Continue to continue creating the child tilemap, so Unity changes the parent grid’s Cell Layout property to match the child tilemap. Alternately you can select Cancel to stop creating the new child tilemap.
Note: If you run the Unity Editor in headless mode, this dialog doesn’t appear and the Editor creates the tilemaps automatically as if you selected Continue.
Additional resources
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。