GUI error: "Getting control 0's position in a group...

Using the following GUI script generates an error message when clicking the button it creates.

The error: “Getting control 0’s position in a group with only 0 controls when doing ignore”

The script:

function OnGUI( )
{
	GUILayout.Button( "Button" );

	GUILayout.BeginVertical( );
	
	GUI.enabled = false;
	GUILayout.Label( "Label" ); 
	GUI.enabled = true;

	GUILayout.EndVertical( );
}

Any info on this?

Thanks!

The code is fine. This kind of error message generally occurs when you have a null reference being thrown inside OnGUI.

Cheers
Shaun

And just copying/pasting that code chunk into a new project works fine for me, no errors at all. Perhaps it’s some other code causing the error instead?

Edit: and I moved this thread to the UnityGUI section as it’s GUI related.

( Sorry about the wrong forum )

Thanks for checking the code. A new project with the code copied/pasted generates the error for me. The error does seem relatively harmless. I’ve submitted a bug report with the project.

No worries on the forum choice, it’s not a big deal. :slight_smile:

As far as your code generating errors for you, that’s odd indeed. Thanks for submitting it as a bug, we’ll see if our dev/qa folks have anything to share.