All objects sleeping not working

I have the following JavaScript to detect when all objects stopped moving and show the menu. But this code does not seem to work as menu never shows up. Can you help me to fix the code?

#pragma strict
static var playing;
var allSleeping: boolean = false;

function Start () {
	yield CheckObjectsHaveStopped();
}

function CheckObjectsHaveStopped()
{
    print("checking... ");
    var GOS: Rigidbody[] = FindObjectsOfType(Rigidbody) as Rigidbody[];  
    allSleeping = false;
 
    while(!allSleeping)
    {
       allSleeping = true;
       for (var GO: Rigidbody in GOS) 
       {
          //if(!GO.IsSleeping()) //Keeps printing "All sleeping is False... "
          if(GO.velocity.magnitude <= 0.1f) //Prints "All sleeping is False... ", even after all objects stopped moving
          									//Menu never shows up
          {
             allSleeping = false;
             print("All sleeping is False... ");
             yield WaitForSeconds(2);
             break;
          }
       }
    }
    print("All objects sleeping");
}

//Show the menu only when all objects stop moving
function OnGUI() {
	if (allSleeping == true) {
		GUI.Box(Rect (Screen.width/8, Screen.height/4, Screen.width/1.3, Screen.height/2), "Game Name");
		
		if (GUI.Button(Rect (Screen.width/2.6, Screen.height/2.8, Screen.width/4, Screen.height/10), "Play")) {
			playing = true;
		}

	if (GUI.Button(Rect (Screen.width/2.6, Screen.height/1.7, Screen.width/4, Screen.height/10), "Quit")) {
			Application.Quit();
		}	
	}
}

I would try a different approach.

Try to save the transformation data in a Vector3 variable. Then start a loop, so every 5 or so seconds it updates and compares the last updates transformation data with the updated one. If they are the same then you know the objects have stopped.

Good luck!