private void MapWorldTiles() { grid = new WorldTile[config.GridSize, config.GridSize, config.GridSize]; for (int i = 0; i < transform.childCount; i++) { WorldTile worldTile = transform.GetChild(i).GetComponent <WorldTile>(); if (worldTile == null) { continue; } // NOTE: Very dependant on world tile's name!!! // TODO: Find a safer way of doing this... string[] string1 = worldTile.name.Split('['); string[] string2 = string1[1].Split(']'); string[] string3 = string2[0].Split(','); int x = Convert.ToInt16(string3[0]); int y = Convert.ToInt16(string3[1]); int z = Convert.ToInt16(string3[2]); worldTile.Setup(x, y, z); grid[x, y, z] = worldTile; flattenedGrid.Add(worldTile); } }