Tidy Tile Mapper‎ > ‎Runtime API‎ > ‎BlockUtilities‎ > ‎


Creates a BlockMap with which you may realize your wildest Block-mapping dreams.


BlockMap CreateBlockMap(string mapName, Vector3 tileScale, int chunkWidth, int chunkHeight, BlockMap.GrowthAxis growthAxis)

Return value Description
BlockMap A BlockMap. You will notice this has been created in your Scene and Hierarchy. Retain a reference to this, as future calls to BlockUtilities functions will require this.

Argument DataType Description
mapName string The name of the map you wish to create. The GameObject created in your scene will be named as such.
tileScale Vector3 The scale of the Blocks which you will add to the BlockMap. This dictates the spacing and placement of Blocks within the BlockMap.
chunkWidth     int The width of the chunk (in Blocks) that the map will be composed of (Recommended: 5).
chunkHeight int The height of the chunk (in Blocks) that the map will be composed of (Recommended: 5).
growthAxis BlockMap.GrowthAxis The growth axis upon which the map will... grow. Up for sidescrolling maps, Forward for top-down maps.


using UnityEngine;
using DopplerInteractive.TidyTileMapper.Utilities;

public class MapDemo : MonoBehaviour {
  //This is the map that we will create and subsequently modify
  BlockMap map = null;
  //Our map properties - correlate directly to the map properties in the Editor Extension
  public Vector3 tileScale = new Vector3(1.0f,1.0f,1.0f);
  public string mapName = "Our demonstration map";
  public BlockMap.GrowthAxis growthAxis = BlockMap.GrowthAxis.Up;
  //The dimensions of our demo map
  public int mapWidth;
  public int mapHeight;
  //This is the Block that we will be using to populate our map
  public Block blockPrefab;
  void Awake(){
    //Step one: Let's create a map
    map = BlockUtilities.CreateBlockMap(mapName, tileScale, 5, 5, growthAxis);
    //Let's enable pooling and kill many demonstration birds with one demonstration stone
  void Update(){
      //We're going to cast a ray, see if we hit a block, and toggle it
      Ray r = Camera.mainCamera.ScreenPointToRay(Input.mousePosition);
      RaycastHit hitInfo;
      if(Physics.Raycast(r,out hitInfo,mapHeight*1.5f)){
        Block b = hitInfo.collider.GetComponent<Block>();
        if(b != null){
          Block newBlock = null;
            //This block is empty, so make it full  
            GameObject o = AssetPool.Instantiate(blockPrefab.gameObject);
            newBlock = o.GetComponent<Block>();
            //Done, add the new block to the map
            //This block is not empty, so make it empty
  void GenerateMap(){
    //Let's build a map
    for(int x = 0; x < mapWidth; x++){
      for(int y = 0; y < mapHeight; y++){
        //Controversially, we're going to populate our map entirely with blocks at first
        //After this, we will click on these blocks and replace them with empty blocks
        GameObject o = AssetPool.Instantiate(blockPrefab.gameObject);
        Block newBlock = o.GetComponent<Block>();