Checking the values of two or more items in an array

Hello guys,

I would like to check, in an if statement, the value of two or more items in an array but I have no clue how I can achieve that. I need your help.

Let’s say I have an array containing bool variables (set to true) and I want to check (ln the Update function) if at least two of them are false, how can I do that?

Thank you!

You can use LINQ by adding using System.Linq;

Then

var numFalse = myArray.Count(b=>!b);
if(numFalse>=2)
{
   // do something
}

Nice, thank you!

I’m going to try this as soon as possible!