Im tryin to make a object pooling system for my WaveSpawner, first i want to instantiate all needed objects an store them in to a 2d array.
this is what i got (objectPool is a 2D array)
objectPool = new GameObject[wave.Length,0]; //set columns
for(int i = 0;i< objectPool.Length;i++)
{
objectPool = new GameObject[i,wave[i].numberToSpawn]; //set row for ech column
}
for (int p = 0; p < wave.Length; p++)
{
for(int i = 0;i<wave[p].numberToSpawn;i++)
{
GameObject gbj = Instantiate(wave[p].spawnObject);
gbj.transform.position = RandomizePositions();
gbj.SetActive(false);
objectPool[p,i]= gbj; //fill 2D array
}
}
THats the Error i got;
Array index is out of range
what im doing wrong?