I’m looking to place an arbitrary number of GameObjects evenly across an arbitrary width. I’ve got something close but it isn’t quite right.
```
-
float newSpacing = rowWidth / (numberOfBlocks + 1); for (int i = 0; i < numberOfBlocks; i++) { GameObject newBlock = (GameObject)Instantiate(blockTemplate, this.gameObject.transform.position, Quaternion.identity); newBlock.transform.parent = this.gameObject.transform; float newXPosition = (rowWidth / 2) - (newSpacing * i) - this.gameObject.transform.localScale.x; newBlock.transform.localPosition = new Vector3(newXPosition, 0, 0); }*
```
What I am attempting there is to first calculate the spacing based on the number of objects I want and the overall width, then place the objects accordingly. I’m finding that while they are spaced evenly, but they’re not centered inside the expected width. What am I missing?