I’m making an asteroid belt generator. I’m trying to make it so that you set the size of the spawn space using a cube with no renderer.

Everything spawns and works other than the fact that they will only spawn around the edge of the cube.

I’m guessing I’m just not thinking of something in the math I did or there may be some nuance I’m not thinking of. Here is the code:

```
var numberOfAsteroids : int;
var asteroidPrefabs : GameObject[];
function Awake(){
CreateBelt();
}
function CreateBelt(){
var sizex = collider.bounds.size.x;
var sizey = collider.bounds.size.y;
var sizez = collider.bounds.size.z;
var currentPos = transform.position;
for(i = 0; i <= numberOfAsteroids; ++i){
var position = Vector3(Random.Range(currentPos.x - (sizex/2),currentPos.x + (sizex/2)),
Random.Range(currentPos.y - (sizey/2),currentPos.y + (sizey/2)),
Random.Range(currentPos.z - (sizez/2),currentPos.z + (sizez/2)));
var newAsteroid = Instantiate(asteroidPrefabs[Random.Range(0,asteroidPrefabs.length)], position, transform.rotation);
}
}
```

I thought that should take the current position, find the min and max for each value, pick a random number. That for x,y,z. Then spawn the object, but there is a disconnect somewhere and I’d appreciate help figuring that out.