言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

GUISkin.font

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public var font: Font;
public Font font;
public font as Font

Description

デフォルトのフォントを設定する

	// Modifies the font only of the current GUISkin.

	var f : Font;

	function 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");
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    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");
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public f as Font

	def OnGUI() as void:
		if not 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')