Delay something until no object has a certain condition

I don’t want the game to advance a level if an object is falling , I already have something on each object that detects this an “isFalling” boolean it goes to false if it doesnt fall simple enough but what would be a good way of checking if any of them is falling, they are all the same objects but what would be a non-expensive way to check wether one is falling and then I want to delay the execution of other code as in make it wait till nothing is falling anymore what would be a good way of doing this?

Thanks,

Jan Julius.

Keep track of all rigidbodies in your game.

private List<Rigidbody>rigList = new List<Rigidbody>();
void Start()
{
    var rig = FindObjectsOfType<Rigidbody>();
    foreach(Rigidbody r in rig)
    {
        rigList.Add(r);
    }
}

Now you got all rigidbody at start.

Any time you add a new rigidbody to the game add it to the list, and also remove it when you destroy one.

Finally, when you should be transiting, check if the velocity is 0:

bool CheckMovingRigidbody()
{
    for(int i = rigList.Count - 1; i >=0; i--)
    {
        if(rigList*.velocity.magnitude < 0.01f)*

{
rigList.RemoveAt(i);
}
}
if(rigList.Count == 0)
{
return true;
}
return false;
}
You use this method to check if all rigidbodies are not moving, if the movement is small enough, you remove the item from the list and you try again later.
Note that this considers that once a rigidbody is not moving, it won’t get moving again since it gets removed from the list and won’t get back in.
EDIT: since you say you have all objects to fall until they are told not to apply the same process but instead of getting the rigidbody and checking the velocity, you grab the script where they are told to move and set a boolean there and set it to false when not moving:
public class Movement:MonoBehaviour{
private bool isMoving = false;

public void MoveObject(){
// Some code
isMoving = true;
}
public void StopMoving(){
isMoving = false;
}
}

Try saving them all in an array or list of your objects (make it an array/list of the Class with the isFalling variable to avoid unnecessary GetComponents and check for the value of isFalling of each one in a for-loop.

YourClass[] objects = new YourClass[5];

for(int i=0; i<objects.Length; i++) {
  if(objects*.isFalling) {*

//Do fun stuff
}
}