- Home /
[C#] Add information, maybe text, check boxes to a GUI.Box.
I'm trying to add lines of texts, optional suggestions for a game. More specifically, Spades. However, I'm having slight trouble with this. I can't see how to add lines of text, or check boxes to a box in GUI.box. Here's what I have so far:
public class CameraGUI : MonoBehaviour {
private int menuSelection = -1;
private string[] button=new string[] {
"Single Player",
"Multi Player",
"Leaderboards"};
public GUISkin mainSkin;
static int startB=25;
static int buttonW=425;
static int buttonH=275;
private int windowW=500;
private int windowH=600;
private int screenW=Screen.width;
void OnGUI() {
GUI.skin=mainSkin;
menuSelection=GUI.SelectionGrid(new Rect(startB,startB,buttonW,buttonH), menuSelection, button, 1);
switch(menuSelection) {
case 0:
SPOptionsWindow();
break;
case 1:
MPOptionsWindow();
break;
case 2:
LeaderboardsWindow();
break;
default:
//error handling here....
break;
}
}
void SPOptionsWindow() {
GUI.Box(new Rect(screenW*.5f,Screen.height*(.25f/10.0f),windowW,windowH), "Single Player Pre-Start Options");
}
void MPOptionsWindow() {
GUI.Box(new Rect(screenW*.5f,Screen.height*(.25f/10.0f),windowW,windowH), "Multi Player Pre-Start Options");
}
void LeaderboardsWindow() {
GUI.Box(new Rect(screenW*.5f,Screen.height*(.25f/10.0f),windowW,windowH), "Leaderboards");
}
}
Comment
Best Answer
Answer by jeThomas · Oct 19, 2014 at 09:05 PM
Hah', I figured it out. I just used GUI.Window instead of GUI.Box.
Your answer

Follow this Question
Related Questions
[C#] Buttons through an Array. 1 Answer
Distribute terrain in zones 3 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Multiple Cars not working 1 Answer
Generate mesh from faces, invisible 1 Answer