ソースコード
using UnityEngine; using UnityEngine.Tilemaps; public static class TilemapExtensions { public static void SetTile ( this Tilemap self, int x, int y, TileBase tile ) { self.SetTile( new Vector3Int( x, y, 0 ), tile ); } public static void SetTile ( this Tilemap self, Vector2Int position, TileBase tile ) { self.SetTile( new Vector3Int( position.x, position.y, 0 ), tile ); } }
(Z 座標は未対応)
使用例
tilemap.SetTile( 0, 0, tile ); tilemap.SetTile( Vector2Int.zero, tile );