void GenerateSquares(DungeonSquare[,] squares) { for (int i = 0; i < length; i++) { GameObject row = new GameObject("Row" + (i + 1)); row.transform.parent = transform; row.transform.position = transform.position; for (int j = 0; j < width; j++) { if (squares[i, j] == null) { continue; } connectLogic.Survey(i, j, squares); #region Setup Square in Hierarchy squares[i, j].layout = connectLogic.BuildLayout(squares[i, j].adjacents); GameObject sq = squares[i, j].layout; sq.transform.parent = transform; sq.transform.localPosition = coordinates[i, j]; sq.transform.parent = row.transform; sq.name = "Sq" + (j + 1); #endregion } } }