how to detect if bool from all script instances in array is true

So, I have an array of other scripts and each one has a bool in them. How do I detect if each one in the array is true? Here is code:

public Script[] otherScript;

void Update()
{
    if (/*the bool is true for all instances in the array*/)
    {
        //do something because the bool is true for all instances in that array
    }
}

I’m just gonna stare at my screen until it’s answered.

Look up how to use for loops!

bool doThing = true;
for (int x=0; x < otherScript.Length; x++) {
if (!otherScript[x].yourBoolName) doThing = false;
}
if (doThing) {
//do thing
}

That will in no way make you an Epic Game Dev.

I’m not sure who taught you that horrible life strategy.

May I suggest an alternative life strategy?

How to do tutorials properly:

Tutorials are a GREAT idea. Tutorials should be used this way:

Step 1. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. Even the slightest deviation generally ends in disaster. That’s how software engineering works. Every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly. Fortunately this is the easiest part to get right. Be a robot. Don’t make any mistakes. BE PERFECT IN EVERYTHING YOU DO HERE.

Step 2. Go back and work through every part of the tutorial again, and this time explain it to your doggie. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. If you are unable to explain any part of it, STOP. DO NOT PROCEED. Now go learn how that part works. Read the documentation on the functions involved. Go back to the tutorial and try to figure out WHY they did that. This is the part that takes a LOT of time when you are new. It might take days or weeks to work through a single 5-minute tutorial. Stick with it. You will learn.

Step 2 is the part everybody seems to miss. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost.

Of course, all this presupposes no errors in the tutorial. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. For some other less-well-known content creators, this is less true. Read the comments on the video: did anyone have issues like you did? If there’s an error, you will NEVER be the first guy to find it.

Beyond that, Step 3, 4, 5 and 6 become easy because you already understand!

Here’s some GREAT starting points:

Imphenzia / imphenzia - super-basic Unity tutorial:

Brackeys super-basic Unity Tutorial series:

Sebastian Lague Intro to Game Development with Unity and C#:

am not stupid i already fully made a shop system with static variables

i just tried this and it got activated even though only 1 of them was true
actually i think i did it wrong but i found this and it works

bool completed = true;
        foreach (Script script in otherScript)
        {
            if (!script.thisBool)
            {
                completed = false;
            }
        }
        if (completed == true)
        {
            //wow it actually works
        }

so basically have a bool that sais the game is completed until proven otherwise