This is the excerpt from my code:
IEnumerator SpawnPickUps()
{
int spawnWait = 5;
GameObject[] arPickUpsCollection = new GameObject[]{pickUp_Ignition, pickUp_Shock, pickUp_Acid, pickUp_Health};
while(true)
{
yield return new WaitForSeconds(spawnWait);
int pickUpRandomizer = Random.Range(0,3);
Instantiate (arPickUpsCollection[pickUpRandomizer], arSpawnPositions[spawnRandomizer], Quaternion.identity);
}
}
The problem is, my pickUp_Health is not instantiated. EVER.
It gets instantiated only when I increase the range to (0,4) which makes no sense, because the pickUp_Health has the index of 3. What may be causing this?