When you modifying an STETilemap by script, you will use the methods SetTileData and GetTileData. They have a parameter called tileData that is an unsigned integer (uint).
This unsigned integer is a raw data representation of a tilemap cell.
This data is divided in different attributes, each of one using different bits of the unsigned integer of 32bits:
- TileId [16bits, from 0 to 15]: this is the id of the tile used to draw this cell.
- BrushId [12bits, from 16 to 27]: this is used to update the tileId when the tilemap mesh is updated
- Flags [4bits, 28, 29, 30 and 31]:
- Updated flag [bit 28]: used to inform the brush and other subsystem when the cell has been updated. For example, in a random brush, it will avoid changing the tileId again after this flag is set the first time.
- Rotate 90º [bit 29]: the cell tile is rotated 90º
- Vertical Flip [bit 30]: the cell tile is flipped vertically
- Horizontal Flip [bit 31]: the cell tile is flipped horizontally
You can see some examples managing a tile data in the tutorial: Set and Get Tile data in an STETilemap
One thought on “Understanding TileData”