OnGUI runs every frame like Update, and can’t be delayed in any way. You can launch a separate coroutine from OnGUI instead (but you must take steps to ensure that it will only be launched once).
I’ve modified some code for you. A very basic way to solve this is to add a boolean (in this example I called it loadingLevel, and set it to false. Then when you add a simple if statement, that says if loadingLevel is false, then it is okay to enter the coroutine LoadLevel(), but before doing so, we set the loadingLevel boolean to true, this way the next time OnGUI runs, it does not enter that if statement, thus calling the LoadLevel() function again. Then the LoadLevel() function simply waits 1 second, then loads the level you specify.
var gui01 : Texture2D;
var gui01rollover : Texture2D;
var loadingLevel : boolean = false;
private var correctedMousePosition : Vector2;
function OnGUI ()
{
correctedMousePosition = Vector2 (Input.mousePosition.x, (Screen.height-Input.mousePosition.y) );
if ( Rect(101,303,88,88).Contains(correctedMousePosition) )
{
GUI.DrawTexture( Rect(101,303,88,88) , gui01rollover);
if( Input.GetMouseButtonUp(0) )
{
if (!loadingLevel)
{
loadingLevel = true;
LoadLevel ();
}
}
}
else
{
GUI.DrawTexture( Rect(101,303,88,88) , gui01);
}
}
function LoadLevel () {
yield WaitForSeconds(1);
Application.LoadLevel("S1_level01");
}