How can I make the size of the font in a label larger?
I used this function to display the text :
function OnGUI()
{
GUI.color = Color.green;
GUI.Label(Rect(500,350,200,50),"Lose");
}
And that results in:
How can I make this text bigger?
Simply create an appropriate GUIStyle
and set the fontSize
. Pass this to your label and you're good to go.
So something like this:
using UnityEngine;
using System.Collections;
public class FontSizeExample : MonoBehaviour
{
GUIStyle smallFont;
GUIStyle largeFont;
void Start ()
{
smallFont = new GUIStyle();
largeFont = new GUIStyle();
smallFont.fontSize = 10;
largeFont.fontSize = 32;
}
void OnGUI()
{
GUI.Label(new Rect(100, 100, 300, 50), "SMALL HELLO WORLD", smallFont);
GUI.Label(new Rect(100, 200, 300, 50), "LARGE HELLO WORLD", largeFont);
}
}
will result in