IndexOutOfRangeException: Array index is out of range, it's my problem with this script at 37th line (GameObject Newaster = Instantiate (aster[spawnObject], spawnPoints [spawnIndex].position, spawnPoints [spawnIndex].rotation) as GameObject;):
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
using System.Collections.Generic;
public class Asteroid : NetworkBehaviour {
public float timeTospawn = 0.5f;
public Transform[] spawnPoints;
public GameObject[] aster;
public List possibleSpawns = new List();
// Use this for initialization
void Start()
{
//fill possible spawn
for (int i = 0;i().mySpawnPoint = possibleSpawns[spawnIndex];
possibleSpawns.RemoveAt(spawnIndex);
}
}
↧