How to have a Boolean check as true after multiple other Booleans are marked true

So I’m making a puzzle game and I was thinking of using a system where the puzzle pieces would check a boolean on a script when their coordinates matched up with the slot they’re supposed to be in. Something like:

var NextLevel : Boolean;
var PosCorrect : Boolean
var P1 : GameObject;
var S1 : GameObject;

function Update(){
if(P1.position = S1.position)(

PosCorrect = true
}

 if(multiple boolean = true){
    
    NextLevel = True;
    
    GUI();
    }

And then I would have a GUI button show up that when clicked would let the player go onto the next level. Is there anyway to do this? And if there is how so.

I’d think I’d have two static arrays Matched and UnMatched. Add all the puzzle pieces to the UnMatched array when you start up. (Perhaps in Start() for each game object.) Then as the player moves a piece to the right location, move the game object from the UnMatched array to the Matched array. You can then have code that looks at the number of entries in the UnMatched array. Once it falls to zero, you know you have all the pieces in their correct locations.

See:

https://unity3d.com/learn/tutorials/modules/intermediate/scripting/statics

if you need help understanding why the arrays should be static.

Use properties. In C# (I’m sure JavaScript has equivalent methods).

private bool[] boolArray;
private bool multiBool {
    get {
        for (int i = 0; i < boolArray.length; i++){
            if (!boolArray*){*

return false;
}
}
return true;
}
}
Checking multiBool will automatically loop through each bool in boolArray and only return true if all of the bools in the array are true.