0

I have a simple enemy wave based survival game

the spawn system have an array of enemy AIs and Spawn Points, I want the spawned prefabs to be removed from the enemies array to avoid getting spawned again, is there a way to do so, here's my code:

public Transform[] spawnPoints;
public GameObject[] enemies;


Pos= spawnPoints[Random.Range (0,spawnPoints.length)]);

AI = Instantiate (enemies[Random.Range (0, enemies.length)]) , Pos);
Moncif Mo
  • 9
  • 8
  • 1
    Shuffle the array then instantiate the first element, then the second element, etc. [Shuffle array in Unity](https://stackoverflow.com/questions/36702548/shuffle-array-in-unity) – Ruzihm Sep 28 '20 at 19:20
  • the post u sent only change the order of variables in array, am looking for a way to remove variables from it – Moncif Mo Sep 28 '20 at 19:23
  • @MoncifMo: So then a duplicate of [this](https://stackoverflow.com/q/457453/328193)? – David Sep 28 '20 at 19:25
  • thanks for pointing out :) I will try looking into it – Moncif Mo Sep 28 '20 at 19:27

0 Answers0