- Home /
how do i change the font size on a gui text box
Im using c#. The unity API didn't help much. In unity, the text look fine, but on the phone the text in the box is so small, that you almost cant read it.
GUI.Box (new Rect (Screen.width / 10, Screen.width / 10 * 8, Screen.width / 10 * 8, Screen.width / 10), "YOUR HIGHEST SCORE WAS: " + PlayerPrefs.GetInt ("highScore"));
Comment
Best Answer
Answer by SnStarr · Jan 24, 2015 at 12:17 AM
void OnGUI() {
// Create style for a button
GUIStyle myButtonStyle = new GUIStyle(GUI.skin.button);
myButtonStyle.fontSize = 50;
// Load and set Font
Font myFont = (Font)Resources.Load("Fonts/comic", typeof(Font));
myButtonStyle.font = myFont;
// Set color for selected and unselected buttons
myButtonStyle.normal.textColor = Color.red;
myButtonStyle.hover.textColor = Color.red;
...
// use style in button
bool testButtonTwo = GUI.Button(new Rect(10,10,50,50), "test", myButtonStyle);
...
}
Answer by Reder13 · Jan 24, 2015 at 02:48 AM
or you could just do:
GUI.skin.box.fontSize = 30;
or whatever size you want. just make sure you do that before your box and if you want a different font for another box just redo it and change the value.