可脚本化瓦片是可以分配行为 脚本一段代码,允许您创建自己的组件,触发游戏事件,随时间推移修改组件属性,并以您喜欢的任何方式响应用户输入。 更多信息
参见 词汇表 的瓦片,您可以在 瓦片地图一个游戏对象,允许您使用瓦片和网格叠加快速创建 2D 关卡。 更多信息
参见 词汇表 组件上绘制可脚本化瓦片。
这些 C# 脚本允许您自定义瓦片与其他瓦片或 TileBase 类定义的其他行为的交互方式。
添加到瓦片地图组件的所有瓦片都必须继承自 TileBase
。TileBase
为瓦片地图提供一组固定的 API 来通信其渲染属性。对于大多数 API 情况,瓦片的放置位置和瓦片放置在其上的瓦片地图实例作为 API 的参数传入。您可以使用它查找设置瓦片信息所需的任何属性。
最常见的重写方法是
RefreshTile
确定当此瓦片添加到瓦片地图时,附近哪些瓦片会更新。GetTileData
确定瓦片在瓦片地图上的显示方式。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.