GUI.Window function not called anymore

I have some weird problem. I don’t use GUI stuff much in my current game (or just stick to the basics), but there was one place where I used GUI.Window to open a confirmation window. Back then when I wrote that part of the GUI everything worked.

I clicked on a button to reset the current games progress and a window opened with a confirmation. Now, a few months later it doesn’t seem to work and nothing was changed there in code.

	if(GUI.Button(new Rect(Screen.width/2-140, Screen.height/2+60, 290, 50),"Clear progress")) {
		bResetStatsDialog = true;
	}

	if(bResetStatsDialog) {
		// Enable GUI elements
		GUI.enabled = true;

		GUI.Window(1, new Rect(Screen.width/2-200,Screen.height/2-100,400,200), DrawConfirmationWindow, "Confirmation Dialog");
	}
}

...

void DrawConfirmationWindow(int windowId) {
	GUI.DragWindow();
	GUI.BringWindowToFront(windowId);
	Rect windowRect = new Rect(30,70,380,200);

	// Display label text
	GUI.Label(windowRect,"Do you want to reset the current game state?");
	if(PlaySound(GUI.Button(new Rect(20, 140,100,40),"Yes"))) {
		// remove all saved settings
		PlayerPrefs.DeleteAll();

		// close window
		bResetStatsDialog = false;
	}
	if(PlaySound(GUI.Button(new Rect(250, 140,100,40),"No"))) {
		// close window
		bResetStatsDialog = false;
	}
}

Once I hit the ‘clear progress’ button, the GUI.Window option is called on every frame correctly. However, the callback (GUI.Window’s “func” parameter, here DrawConfirmationWindow) function is never called and I have no idea what’s causing it.

Did anything changed with the GUI stuff in the most recent Unity version? (3.4/3.4.1)? I could swear it was working with 3.3 (with 3.2 I’m 100% certain). Or is it some kind of bug which was introduced with Unity 3.4?

With a little help of the unity support and stripping of my GUI code, if found the problem.

It was caused by an useGUILayout = false; in my Awake() method. While the useGUILayout documentation states that it won’t work with GUI.Window, the GUI.Window lacked any documentation/note, so it wasn’t very obvious that the useGUILayout was causing it