unity3d editor - How to check unknown number of booleans c# -
i need check unknown number of booleans.. depending on result appropriate function. here example of i'm searching:
if(bool[x] && bool[y] && bool[z] ...) myfunc();
you can use linq
that.
if need bools true, can use any
:
if (bools.all(b => b))
if need, example, 4 of them true, can use count
:
if (bools.count(b => b) == 4)
or @ least one, there's any
if (bools.any(b => b))
Comments
Post a Comment