I have this code, and everytime I run it, it display the same value. It is always 0, 6, 3, 1. What may be the problem?
public Transform[] SpawnPoints;
public GameObject[] Trash;
// Use this for initialization
void Start () {
SpawnTrash ();
}
void SpawnTrash(){
for (int i = 0; i < Trash.Length; ++i) {
int spawnIndex = Random.Range (0, SpawnPoints.Length);
Instantiate (Trash *, SpawnPoints [spawnIndex].position, SpawnPoints [spawnIndex].rotation);*
-
Debug.Log (spawnIndex);*
-
}*
- }*