private void CreateTiles() { Tiles = new GameObject[Width + 1, Height + 1]; Units = new GameObject[Width + 1, Height + 1]; Areas = new GameObject[Width + 1, Height + 1]; for (int x = 1; x <= Width; x++) { for (int y = 1; y <= Height; y++) { GameObject tile = Instantiate <GameObject>(TilePrefab, this.transform); tile.transform.SetParent(this.transform); RectTransform rt = (RectTransform)tile.transform; tileWidth = rt.rect.width; tileHeight = rt.rect.height; // Show text //TextMeshPro text = tile.transform.Find("Text").gameObject.GetComponent<TextMeshPro>(); //text.SetText(x.ToString() + ";" + y.ToString()); tile.transform.localPosition = PointerToIcometric(new Point(x, y), tileWidth, tileHeight); TileDisplay tileDisplay = tile.GetComponent <TileDisplay>(); tileDisplay.x = x; tileDisplay.y = y; tileDisplay.SetText(x + " " + y); Tiles[x, y] = tile as GameObject; } } }