OnGUI calls seem to happen twice for each LateUpdate?

I am drawing a screenspace box round objects using GUI.box. It works but there’s a strange effect I don’t understand: for every LateUpdate() I seem to be getting two OnGUI().
Here’s my code snippet:

Rect box;
bool boxing = false;

// other code to manage state of boxing
//GUIRectWithObject() returns a screen space Rect

void LateUpdate ()
{
	Renderer rend = this.gameObject.GetComponent<Renderer> ();

		if (boxing && rend.isVisible) {
			box = GUIRectWithObject (this.gameObject);
			Debug.Log ("Defined: " + box);
		}
}

void OnGUI (){
	Renderer rend = this.gameObject.GetComponent<Renderer> ();
	if (boxing && rend.isVisible) {
		GUI.Box (box, GUIContent.none);
		Debug.Log ("Drawn: " + box);
	}
}

The log looks like this:

Defined: (x:41.08, y:225.82, width:25.11, height:18.45)
UnityEngine.Debug:Log(Object)
EnclosedObject:LateUpdate() (at Assets/Scripts/Output scripts/EnclosedObject.cs:44)

Drawn: (x:41.08, y:225.82, width:25.11, height:18.45)
UnityEngine.Debug:Log(Object)
EnclosedObject:OnGUI() (at Assets/Scripts/Output scripts/EnclosedObject.cs:52)

Drawn: (x:41.08, y:225.82, width:25.11, height:18.45)
UnityEngine.Debug:Log(Object)
EnclosedObject:OnGUI() (at Assets/Scripts/Output scripts/EnclosedObject.cs:52)

This repeats with two drawn messages for each defined message. Can anyone tell me what is going on? Thanks.

OnGUI is an event processing method. It is called for all sorts of events. By default two events are raised every frame: Layout and Repaint. However in addition it’s called seperately for KeyDown or KeyUp events. For more information see my IMGUI crash course

Thanks for the reply; that explains things. Thanks also for the tip about disabling the layout event, that might be handy in the future.