public int AddGridRow(bool infinite = false) { int yScale = GetGridRowHeight(infinite: infinite); var xPos = StartMapPoint.transform.position.x; var yPos = currentYPoint + StartMapPoint.transform.position.y; GridRow row = CreateGridRow(xPos, yPos, yScale); row.gameObject.name = _depthIndex + "_row[" + (currentYPoint + yScale) + "]"; row.Index = _depthIndex; int[] columnsWidths = GenerateColWidths(); var cPosX = row.transform.position.x; for (var i = 0; i < columnsWidths.Length; i++) { GridColumn gC; if (columnsWidths.Length == 2 && i == 1) { cPosX = (_xLength - columnsWidths[i]) + row.transform.position.x; gC = CreateGridColumn(_depthIndex, i, cPosX, currentYPoint, yScale, columnsWidths[i], row.transform); row.AddColumn(gC); break; } gC = CreateGridColumn( _depthIndex, i, cPosX, currentYPoint, yScale, columnsWidths[i], row.transform); row.AddColumn(gC); cPosX = cPosX + columnsWidths[i]; } if (infinite == false && currentYPoint < pointsUp) { currentYPoint = currentYPoint + yScale; } _depthIndex++; return(yScale); }