【发布时间】:2018-08-11 20:27:29
【问题描述】:
我发现的每个示例仅与新的 tilemap 系统有关,仅使用 GetTile 查找一个图块,然后使用“this”将其与自身进行检查。例如。
private bool HasOtherTile(ITilemap tilemap, Vector3Int position)
{
return tilemap.GetTile(position) == this;
}
我希望能够改为检查其他特定图块。例如我创建的带有我的public class WallTile : TileBase 脚本的 WallTile.asset 磁贴。我真的很困惑如何做到这一点。
我尝试过使用
gameObject.AddComponent(WaterTile)
TileBase tileTest = gameObject.AddComponent(WallTile);
private bool HasRoadTile(ITilemap tilemap, Vector3Int position)
{
TileBase tileTest = gameObject.AddComponent(WaterTile);
return tilemap.GetTile(position) == tileTest;
}
但这似乎不起作用。
我也试过ScriptableObject.CreateInstance(WaterTile),但也没有用。
@桑德罗·菲戈 The GetTile method doesn't seem to have an extension method for gameObject it seems.
【问题讨论】: