GUI styles

i’m building a simple end of level info box and can’t quite understand where
some of the default box parameters in GUI skin are coming from. In the GUI.Box statement if i omit the style argument i get a nice box with an outline and rounded corners but when i specify my own custom style i can’t find the parameters to specify outline and corners. Also is it necessary to use the completionStyle.CalcSize function in this way. If Unity can calculate the pixel width of any given text string then presumably it can pre-format the whole thing in one call.

	if (displayCompletionForm)
	{
		var completionText : String = "'" + controller.figures[controller.figureIndex].name;
		completionText = completionText + "' completed!";
		var boxWidth = completionStyle.CalcSize(new GUIContent(completionText)).x;
		completionText = completionText + "\nTime: ";
		completionText = completionText + buildTimeString ();
		GUI.backgroundColor = Color(0.53, 0.39, 0.27, 0.80);

		GUI.Box(Rect((Screen.width - boxWidth) /2, 120, boxWidth + 10.0 ,80), completionText /*, completionStyle*/);

}

Hi,

Try using GUILayout, it makes dynamic sizing of elements much easier. All info is in the Unity manual along with examples.

As for your visual problem, you need to specify the background texture for the normal state of your GUIStyle, then use the border settings to specify which part gets tiled and which part is used for the outer border.

Best regards
Shaun

hi shaun thanks for the reply. I’d be happy to adopt the default texure/edges/corners etc if could just copy them. where are they kept?
cheers
rod

Here:
http://unity3d.com/support/resources/assets/built-in-gui-skin
And extras here:
http://unity3d.com/support/resources/assets/extra-gui-skins

You’ll need to roll your own GUISkin and reference it from your scripts.