Check if all the boxes are deactivated, then finish.

Hey guys, so I’m working on a game that the player needs to destroy all the boxes in the map by jumping on them and reach the end. I want the end block check and see if all the boxes are destroyed (Deactivated) then print something like “you won!” on the screen and give the player the option to press enter to try the same level again or press X to continue to next level. I only want the part that checks if all the boxes are gone. I know I have to use a For loop but I’m not quite sure how I’m supposed to script it since I’m fairly new to this.
Here is where this script should go I believe:

var text : GUIText;
var colliding : boolean;
private var displayText : String = ""; 
 
function Update()
{
    if (colliding)
    {
       text.enabled = true;
    }
    else
    {
       text.enabled = false;
    }
}
 
function OnTriggerEnter(col : Collider)
{
    if (col.gameObject.CompareTag("Player"))
    {
       colliding = true;
       
       displayText = "You Won!";
    
      Application.LoadLevel(Application.loadedLevel);
  }
}

function OnGUI()
{
    GUI.Box(Rect((Screen.width / 2) - 70, 10, 140, 40), displayText);
}

Thank you.

sorry for the bump but can someone please help me with this? I’m really desperate on this one…

I think you might want to get a separate script to check if all the boxes are deactivated. You can get the box to inform the object with the script to do a check when the box gets deactivated so you don’t have to continuously check.