void CreateGrid() { for (int y = 0; y < gridHeight; y++) //9 { for (int x = 0; x < gridWidth; x++) //6 { Transform hex = Instantiate(hexPrefab) as Transform; BallController ballCont = hex.GetComponent <BallController>(); Vector2 gridPos = new Vector2(x, y); Vector3 newPos = CalcWorldPos(gridPos); hex.position = newPos; ballCont.startPos = newPos; ballCont.index = totalBall; hex.parent = this.transform; hex.name = "Hexagon" + x + "|" + y; if (y >= gridActiveRaw) { ballCont.DeActivateBall(); } else { ballCont.InitBall(); } Balls.Add(ballCont); totalBall++; } } }