How would I go about getting the index of an element at an array if it meets particular criteria. For example I have two arrays of 6 boolean elements which are performing similar functions. For the first only one element can ever be true and I would like to get the index value of the element which is true. For the second any number could be true and I would like to flag all which are true. So far creating a for loop and iterating through each has created some problems when I try to display the values. Either I don’t get the values past the first element that is true or I can only get the last value.
Sorted it out. While I was not able to determine the index of a given value as per my original question I did solve my issue. As well, the documentation for arrays and lists would indicate that there is some way to find an index but it looks like I can bypass that altogether.
I put the following line after my loop rather than use the else in the loop.
if (!tile.influence.Contains(true)){
influencetxt.text = "None";
}
Now if all values return false I get the message I want.