To give some background on my situation, I have six scripts in a list. Each item has a script with a boolean value. I want to know when the boolean in four of the six scripts is true. Is there way I can do this?
since I don’t know how your scripts are arranged, I’m doing this with a generic list of bools, but you should be able to fix it to match your scripts.
Anyhoo, I imagine it’d go something like this:
// list of 6 boolean values
List<bool> values = new List<bool>
{
true, true, false, true, true, false
};
if (values.FindAll(val => val == true).Count >= 4)
{
// at least 4 values are true!
}