Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

EditorGUI.LabelField

マニュアルに切り替える
public static function LabelField(position: Rect, label: string, style: GUIStyle = EditorStyles.label): void;
public static function LabelField(position: Rect, label: GUIContent, style: GUIStyle = EditorStyles.label): void;
public static function LabelField(position: Rect, label: string, label2: string, style: GUIStyle = EditorStyles.label): void;
public static function LabelField(position: Rect, label: GUIContent, label2: GUIContent, style: GUIStyle = EditorStyles.label): void;
public static function LabelField(position: Rect, label: string, style: GUIStyle = EditorStyles.label): void;
public static function LabelField(position: Rect, label: GUIContent, style: GUIStyle = EditorStyles.label): void;
public static function LabelField(position: Rect, label: string, label2: string, style: GUIStyle = EditorStyles.label): void;
public static function LabelField(position: Rect, label: GUIContent, label2: GUIContent, style: GUIStyle = EditorStyles.label): void;

パラメーター

position ラベルの表示される位置
label Label Field の前のラベル
label2 右側に表示するラベル
style ラベルを表示するための Style 情報 (色など)

説明

Label Field を作成します (読み取り専用の情報を表示するために便利です)。


" Editor Window にラベルとエディター起動後からの秒数を表示しています。"

	// Shows a label in the editor with the seconds since the editor started
	
	class EditorGUILabelField extends EditorWindow {	
		@MenuItem("Examples/EditorGUI Label Usage")
		static function Init() {
			var window = GetWindow(EditorGUILabelField);
			window.Show();
		}
		function OnGUI() {
			EditorGUI.LabelField(Rect(3,3,position.width, 20),
				"Time since start: ", 
				EditorApplication.timeSinceStartup.ToString());
			this.Repaint();
		}
	}