var amount = 0;
function Start(){
for (amount=0; amount<3; amount++)
Spawn();
}
Watch out: I cannot say if the rest of your code is correct (even because you have not formatted it properly): this is simply the logic behind calling a function 3 times as the application starts.
function Spawn (quantity : int) {
for (var i : int = 0; i<quantity; i++) {
//Select From Objects To Spawn
var thingToSpawn : int = Random.Range( 0, objectsToSpawn.length );
//Select From Spawn Locations
var placeToSpawn : int = Random.Range( 0, spawnLocations.length );
Instantiate( objectsToSpawn[thingToSpawn], spawnLocations[placeToSpawn].position,transform.rotation);
}
}
You could also pass more variables to the function, to switch objects or so:
function Spawn (quantity : int, thing : GameObject) {}