I was wondering if there was a way to change a font in unity’s OnGUI function
I can change the color I just wanna know how to change the font.
I was wondering if there was a way to change a font in unity’s OnGUI function
I can change the color I just wanna know how to change the font.
style = new GUIStyle();
style.font = labelFont;
style.fontSize = 20;
style.richText = true;
style.normal.textColor = Color.white;
style.alignment = TextAnchor.MiddleCenter;
// later...
GUI.Label(new Rect(textLocation.x
,Screen.height - 50
,0, 0), craft, style);
Yep…
public Font f;
void OnGUI() {
if (!f) {
Debug.LogError("No font found, assign one in the inspector.");
return;
}
GUI.skin.font = f;
GUILayout.Label("This is a label with the font");
GUILayout.Button("And this is a button");
}