Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

GUIStyle.font

var font: Font;
Font font;
font as Font

Description

The font to use for rendering. If null, the default font for the current GUISkin is used instead.

	// Prints name of the font that button is using.

function OnGUI() { Debug.Log("Font name: " + GUI.skin.button.font.name); }

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void OnGUI() {
        Debug.Log("Font name: " + GUI.skin.button.font.name);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def OnGUI() as void:
		Debug.Log(('Font name: ' + GUI.skin.button.font.name))