private void CreateGridCells()
        {
            var bounds          = new BoundsInt(Vector3Int.zero, new Vector3Int(size.x, size.y, 1));
            var allTiles        = interactiveTilemap.GetTilesBlock(bounds);
            var emptyTiles      = tilemapOfTileToIncludeIfEmptyTile.GetTilesBlock(bounds);
            var backgroundTiles = backgroundTilemap.GetTilesBlock(bounds);

            var canvas = transform.parent.GetComponent <Canvas>();

            if (canvas != null)
            {
                canvas.GetComponent <RectTransform>().sizeDelta = size;
            }

            for (var j = size.y - 1; j >= 0; j--)
            {
                for (var i = 0; i < size.x; i++)
                {
                    var currentTile       = allTiles[i + j * size.x];
                    var createdGameObject = InstantiateCellPrefabFrom(currentTile);
                    if (currentTile == null)
                    {
                        currentTile = emptyTiles[i + j * size.x] == null ? backgroundTiles[i + j * size.x] : emptyTiles[i + j * size.x];
                    }
                    if (createdGameObject != null)
                    {
                        createdGameObject.AddComponent <TileSprite>().SetSprite(((UnityEngine.Tilemaps.Tile)currentTile).sprite);
                    }
                }
            }
        }
        public void CreateGridCells()
        {
            BoundsInt bounds = tilemap.cellBounds;

            TileBase[] allTiles          = tilemap.GetTilesBlock(bounds);
            Rect       cellGridRectangle = GetComponent <RectTransform>().rect;

            int minX = GetMinX(bounds, cellGridRectangle);
            int minY = GetMinY(bounds, cellGridRectangle);
            int maxX = GetMaxX(bounds, cellGridRectangle);
            int maxY = GetMaxY(bounds, cellGridRectangle);

            GetComponent <RectTransform>().sizeDelta = new Vector2(maxX - minX, maxY - minY);

            for (int y = maxY - 1; y >= minY; y--)
            {
                for (int x = minX; x < maxX; x++)
                {
                    InstantiateCellPrefabFrom(allTiles[x + y * bounds.size.x]);
                }
            }
        }