Version: 2022.3
public Font font ;

描述

用于所有样式的默认字体。

using UnityEngine;

public class Example : MonoBehaviour { // Modifies the font only of the current GUISkin.

public Font font;

void OnGUI() { if (!font) { Debug.LogError("No font found, assign one in the inspector."); return; } GUI.skin.font = font;

GUILayout.Label("This is a label with the font"); GUILayout.Button("And this is a button"); } }