Hey there. As the title says, is there a way to get this? It’s a pretty important part for my game and i’ve spent the last hour trying to find a way to do this and have found no answers.
Thanks, in advance!
Hey there. As the title says, is there a way to get this? It’s a pretty important part for my game and i’ve spent the last hour trying to find a way to do this and have found no answers.
Thanks, in advance!
Make a list which stores booleans, than iterate through it to find the first true item.
List <bool> myList = new List <bool> ();
//adds stuff to list
myList.add(false);
myList.add(false);
myList.add(false);
myList.add(true);//the list will get this one
myList.add(false);
//list which iterates through boolean values
for(int i = 0; i < myList.Count; i++){
if(myList*){*
Debug.Log(i.ToString()); //returns i, the index of the first true item in myList
break; //breaks out of the list
}
}