Hi, I am trying to have 36 different spawn points and each spawns a random item out of a list of 10. Right now, I have it so that the game randomly picks an item and has that one item spawn at all 36 spawns. How do I make it so that my Instantiate and array lists make a chance for a random item to spawn at all 36 spawns.

Code:

public var Block : Transform [];
public var objectToSpawn : GameObject [];

var TimeToSpawn : int;
var RandomNumber : int;
var BuildingChoice : int;
BuildingChoice = Random.Range(1.0, 10.0);
TimeToSpawn = Random.Range(1.0,3.0);


function Update () 
{
if(Input.GetKeyDown(KeyCode.Space)) 
{
Invoke ("spawnObject", TimeToSpawn); /
}
}



function Start () 
{
}

function spawnObject()
{
	for(var n = 0; n < 36; n++)
	{
	Instantiate (objectToSpawn[BuildingChoice], Block[n].position, Block[n].rotation); 
	}
}

You need to put building choice in the for loop so that the item is picked randomly each time and not at the start once.

 function spawnObject()
 {
     for(var n = 0; n < 36; n++)
     {
     BuildingChoice = Random.Range(1.0, 10.0);
     Instantiate (objectToSpawn[BuildingChoice], Block[n].position, Block[n].rotation); 
     }
 }