The Tilemap component is a system which stores and handles Tile Assets for creating 2D levels. It transfers the required information from the Tiles placed on it to other related components such as the Tilemap Renderer and the Tilemap Collider 2D. This package is not included in the Unity Editor default installation by default, and you will need to download the 2D Tilemap Editor package via the Package Manager.
创建瓦片地图时,Grid 组件自动作为瓦片地图的父级,并在将瓦片布置到瓦片地图上时作为参照。
要创建、修改和选择要绘制到瓦片地图上的瓦片,请使用 Tile Palette(菜单:__Window > 2D > Tile Palette__)及其工具。请参阅有关 Tile Palette 和绘制瓦片地图的文档以了解更多信息。
属性 | 功能 |
---|---|
Animation Frame Rate | Unity 播放瓦片动画的速率。增加或减少此值会根据等效因子更改速度(例如,如果将此值设置为 2,Unity 将以两倍速度播放瓦片动画)。 |
Color | 选择一种颜色应用为此瓦片地图上的瓦片的色调。设置为白色(默认颜色)可使 Unity 不带色调地渲染瓦片。 |
Tile Anchor | 输入瓦片地图上沿 XYZ 轴偏移瓦片锚点位置的数量(以单元格为单位)。 |
Orientation | 选择瓦片地图上瓦片的方向。如果需要在特定平面定位瓦片,请使用此属性。 |
XY | Unity 在 XY 平面上定位瓦片。 |
XZ | Unity 在 XZ 平面上定位瓦片。 |
YX | Unity 在 YX 平面上定位瓦片。 |
YZ | Unity 在 YZ 平面上定位瓦片。 |
ZX | Unity 在 ZX 平面上定位瓦片。 |
ZY | Unity 在 ZY 平面上定位瓦片。 |
Custom | 选择此选项可启用以下自定义方向设置。 |
Position | 设置自定义方向的位置偏移。默认情况下禁用此选项,在 Tilemap 的方向设置为 Custom 时启用。 |
Rotation | 设置自定义方向的旋转。默认情况下禁用此选项,在 Tilemap 的方向设置为 Custom 时启用。 |
Scale | 设置自定义方向的比例。默认情况下禁用此选项,在 Tilemap 的方向设置为 Custom 时启用。 |
Info | Expand this to show the Assets used in the Tilemap. |
Tiles | Shows a list of Tile Assets used in the Tilemap. |
Sprites | Shows a list of Sprites used in the Tilemap. |
可从 2D Extra GitHub 代码仓库下载脚本化瓦片和画笔的示例。可从 2D Techdemos Github 代码仓库获取包含这些脚本化游戏对象的示例项目。有关不同脚本和用法信息的描述,请参阅每个代码仓库的 README.md。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.