Scripting API

Tilemap

class in UnityEngine.Tilemaps · UnityEngine.TilemapModule · inherits from GridLayout

76 of 76 of Unity's membersUnity's documentation
In Tassix

Tiles in the cells of its parent Grid. Each cell keeps its tile and what the tile said to show (sprite, color, transform, flags, collider shape), which SetColor and SetTransformMatrix change unless the tile's flags lock them. A TilemapRenderer draws the cells and a TilemapCollider2D makes them solid.

Constructors 1

Properties 12

float animationFrameRate { get; set; }
BoundsInt cellBounds { get; }
Color color { get; set; }
Vector3Int editorPreviewOrigin { get; }
Vector3Int editorPreviewSize { get; }
Grid layoutGrid { get; }
Bounds localBounds { get; }
Orientation orientation { get; set; }
Matrix4x4 orientationMatrix { get; set; }
Vector3Int origin { get; set; }
Vector3Int size { get; set; }
Vector3 tileAnchor { get; set; }

Methods 60

void AddTileAnimationFlags(Vector3Int position, TileAnimationFlags flags)
void AddTileFlags(Vector3Int position, TileFlags flags)
void BoxFill(Vector3Int position, TileBase tile, int startX, int startY, int endX, int endY)

Fills the rectangle from (startX, startY) to (endX, endY), both inclusive, at the position's z; nothing when the position is outside it.

void ClearAllEditorPreviewTiles()
void ClearAllTiles()
void CompressBounds()

Bounds shrunk to just the cells holding tiles.

bool ContainsTile(TileBase tileAsset)
void DeleteCells(Vector3Int position, Vector3Int deleteCells)
void DeleteCells(Vector3Int position, int numColumns, int numRows, int numLayers)

Removes cells from the position on and shifts later ones back.

void EditorPreviewBoxFill(Vector3Int position, Object tile, int startX, int startY, int endX, int endY)
void EditorPreviewFloodFill(Vector3Int position, TileBase tile)
void FloodFill(Vector3Int position, TileBase tile)

Fills the cell and the connected cells holding the same tile as it.

int GetAnimationFrame(Vector3Int position)
int GetAnimationFrameCount(Vector3Int position)
float GetAnimationTime(Vector3Int position)
Vector3 GetCellCenterLocal(Vector3Int position)
Vector3 GetCellCenterWorld(Vector3Int position)
Tile.ColliderType GetColliderType(Vector3Int position)
Color GetColor(Vector3Int position)
Color GetEditorPreviewColor(Vector3Int position)
Sprite GetEditorPreviewSprite(Vector3Int position)
TileBase GetEditorPreviewTile(Vector3Int position)
T GetEditorPreviewTile<T>(Vector3Int position)
TileFlags GetEditorPreviewTileFlags(Vector3Int position)
Matrix4x4 GetEditorPreviewTransformMatrix(Vector3Int position)
GameObject GetInstantiatedObject(Vector3Int position)
GameObject GetObjectToInstantiate(Vector3Int position)
Sprite GetSprite(Vector3Int position)
TileBase GetTile(Vector3Int position)
T GetTile<T>(Vector3Int position)
TileAnimationFlags GetTileAnimationFlags(Vector3Int position)
TileFlags GetTileFlags(Vector3Int position)
TileBase[] GetTilesBlock(BoundsInt bounds)
int GetTilesBlockNonAlloc(BoundsInt bounds, TileBase[] tiles)
int GetTilesRangeCount(Vector3Int startPosition, Vector3Int endPosition)
int GetTilesRangeNonAlloc(Vector3Int startPosition, Vector3Int endPosition, Vector3Int[] positions, TileBase[] tiles)
Matrix4x4 GetTransformMatrix(Vector3Int position)
int GetUsedSpritesCount()
int GetUsedSpritesNonAlloc(Sprite[] usedSprites)
int GetUsedTilesCount()
int GetUsedTilesNonAlloc(TileBase[] usedTiles)
bool HasEditorPreviewTile(Vector3Int position)
bool HasTile(Vector3Int position)
void InsertCells(Vector3Int position, Vector3Int insertCells)
void InsertCells(Vector3Int position, int numColumns, int numRows, int numLayers)

Shifts the cells at and past the position along each axis by the counts given.

void RefreshAllTiles()
void RefreshTile(Vector3Int position)
void RemoveTileAnimationFlags(Vector3Int position, TileAnimationFlags flags)
void RemoveTileFlags(Vector3Int position, TileFlags flags)
void ResizeBounds()

Bounds that take in every tile (and the old bounds).

void SetAnimationFrame(Vector3Int position, int frame)
void SetAnimationTime(Vector3Int position, float time)
void SetColliderType(Vector3Int position, Tile.ColliderType colliderType)
void SetColor(Vector3Int position, Color color)

Changes a cell's color, unless its flags lock it.

void SetEditorPreviewColor(Vector3Int position, Color color)
void SetEditorPreviewTile(Vector3Int position, TileBase tile)
void SetEditorPreviewTransformMatrix(Vector3Int position, Matrix4x4 transform)
void SetTile(Vector3Int position, TileBase tile)
void SetTile(TileChangeData tileChangeData, bool ignoreLockFlags)
void SetTileAnimationFlags(Vector3Int position, TileAnimationFlags flags)
void SetTileFlags(Vector3Int position, TileFlags flags)
void SetTiles(Vector3Int[] positionArray, TileBase[] tileArray)
void SetTiles(TileChangeData[] tileChangeDataArray, bool ignoreLockFlags)
void SetTilesBlock(BoundsInt position, TileBase[] tileArray)
void SetTransformMatrix(Vector3Int position, Matrix4x4 transform)

Changes a cell's transform, unless its flags lock it.

void SwapTile(TileBase changeTile, TileBase newTile)

Events 3

static event Action<Tilemap, NativeArray<Vector3Int>>? loopEndedForTileAnimation
static event Action<Tilemap, NativeArray<Vector3Int>>? tilemapPositionsChanged
static event Action<Tilemap, SyncTile[]>? tilemapTileChanged