Skip to main content

TilemapExtended

TilemapExtended : MonoBehaviour

The main component which stores cell data and manages the correct methods depending on the grip type in use.

Properties

Serialized

Name
Type
Description
gridGridThe grid object holding tilemaps in use
tilemapsTilemap[]The tilemaps used to scan tiles for data storage
tileRulesTileRulesReference to the rule container used for scanning

Public

Name
Type
Description
DataCellsCellDataStoreDataCell store
GridExtendedGridExtendedMain class for grid based methods
PathfinderPathfinderPath to the resource

Public methods

Initialize

public void Initialize(Grid newGrid, Tilemap[] newTilemaps)

Initializes TilemapExtended with the given grid and tilemaps. This method can be used to assign grid and tilemaps dynamically at runtime.

caution

Keep in mind that cell data, grid utility methods and pathfinding will only function correctly after initialization.

Parameters

  • newGrid: The grid object you wish to assign.
  • newTilemaps: The tilemap collection that will be used for scanning tiles (can be a single tilemap).

Example

//Find the TilemapExtended object
var tilemapExtended = GameObject.Find("TilemapExtended").GetComponent<TilemapExtended>();
//Find the grid object and get all tilemap children compoments
var grid = GameObject.Find("MyGrid");
var tilemaps = grid.GetComponentsInChildren<Tilemap>();

//TilemapExtended will now be initialized and scan tiles
tilemapExtended.Initialize(grid, tilemaps);