OK I am a noob with GUIs in C# (mostly C# in general) and I’m trying to add an “about” page to my game. I have GUILayout.label for my button, but I can’t add another one for the actual text for the about page. I want to get it to where I can show the text from a txt file (I know about text assets) and that’s not the problem. The problem is that I can’t add the new GUI that shows the information after I click the about button. Here’s my code:
`
void OnGUI() {
if (isLocked == false) {
GUILayout.BeginArea (new Rect (0, 0, Screen.width, Screen.height));
GUILayout.BeginHorizontal ();
GUILayout.FlexibleSpace ();
GUILayout.BeginVertical ();
GUILayout.FlexibleSpace ();
GUI.skin = buttonSkinThing;
if (GUILayout.Button ("About", "label")) {
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
[Whatever GUIText here to show text from file/about page]
Time.timeScale = 1;
Debug.Log ("Resume Game");
}
if (GUILayout.Button ("Exit", "label")) {
Debug.Log ("Exit Game");
}
GUILayout.FlexibleSpace ();
GUILayout.EndHorizontal ();
GUILayout.FlexibleSpace ();
GUILayout.EndVertical ();
GUILayout.EndArea ();
} else {
Debug.Log ("CRAP");
}
}`
I know that some of it is junk like the flexible spaces and the endhorizontals, but all I need is for it to have a button that I can click that says “about”. WHen I click that, I want it to go away and show another GUI with the text in a txt file. Anyone know why I’m messing this up?