Y
Y
Yura Mailler2020-12-20 20:13:00
Unity
Yura Mailler, 2020-12-20 20:13:00

How to remember a number in a unit?

Hello! I do loot boxes and it is necessary for the unit to remember whether the character fell out or not, if yes, then open it again
(well, in general, so that the same one does not fall),
I do this using lists and check using the for loop and if there is such a number, then we make a discovery again,
but it does not save (without PlaerPrefs, I don’t know how to remove it, you can’t save the list) in general, how to make this save?

int Num;
int i = 0;
List<int> ItsPers = new List<int>();  //список

for(; i > ItsPers.Count ; i++){
     if(Num == i){
            Num = Random.Range(1,10);
     }
     else{
     ItsPers.Add(Num);
     }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question