- Home /
How do i change the GUI.Box font size and box size ?
In the top of the script i added:
private GUIStyle fontSize;
Then inside the Start function:
private void Start()
{
fontSize = new GUIStyle();
fontSize.fontSize = 32;
}
Then inside the OnGUI event:
void OnGUI()
{
GUI.Box(new Rect(10, 10, 100, 100), "Teleportation Booths");
GUI.Label(new Rect(20, 40, 180, 120), "Booth Number: " + boothIndex.ToString(), fontSize);
}
If i change the first line in the OnGUI to:
GUI.Box(new Rect(10, 10, 100, 100), "Teleportation Booths", fontSize);
Then the size of the font/text of the box is now bigger but then it's now showing the box anymore. So i tried also to change the Rect from 100, 100 to 150, 150 but it's not showing the box yet.
What i'm getting in first place is this:
What i want to do is to make a box with a reasonable text size to be able to read with some buttons and some places for information in real time.
So maybe the text of the label is too big so something in the middle maybe. But i can't set the box size.
guibox.png
(65.5 kB)
Comment