In this script i am creating a random number diffrent from the previous one. I would like it to be random number diffrent from the TWO previous ones but i can't get it to work. Does someone know the answer to this?
void SpawnElement() {
prevSpawnIndex = prefabIndex;
while (prevSpawnIndex == prefabIndex)
{
prefabIndex = Random.Range(0, prefabList.Count);
}
moveHelper = Instantiate(prefabList[prefabIndex]);
}
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire