int x,y; for( y = 0; y < shipY; y++) { for( x = 0; x < shipX; x++) { foreach(Tile t in modualeList.GetComponent<ModualeList>().tile) { /* find floor layer and set all colors from the bit map to gen a random floor tile to the floor layer in the TileMap */ if(textureColors [x+y*shipX] == t.tileColor) { shipTileMap.GetComponent<tk2dTileMap>().SetTile(shipX,shipY,0,131); } } } } shipTileMap.GetComponent<tk2dTileMap>().Build(); }