There is an layout area that contains a label. The label has a dynamic text, which can change in length. Therefore the effective height and width of the area is not know. The label is mark as no wrap in the gui skin. How can I make this layout area appear in the middle of the screen?
public Texture2D image
private int step = 0;
private String[] stepMessages = { "one", "two", "very long text", "even longer text with
breaks…" };
void OnGUI()
{
// This whole area should appear in the middle of the screen
GUILayout.BeginArea(new Rect(???, ???, ???, ???));
GUILayout.BeginVertical("box");
if (step > 0) {
GUILayout.Label(image);
}
GUILayout.Label(stepMessages[step]);
GUILayout.EndVertical();
GUILayout.EndArea();
}
I am not sure how to do it. Isn't text anchor control alignment of text inside the label? How do I define my own GUIStryle and what is the difference between GUIStyle and GUISKin? Can you provide an example?
– anon74228096