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

スクリプト言語

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

EditorGUILayout.TagField

フィードバック

ありがとうございます

この度はドキュメントの品質向上のためにご意見・ご要望をお寄せいただき、誠にありがとうございます。頂いた内容をドキュメントチームで確認し、必要に応じて修正を致します。

閉じる

送信に失敗しました

なんらかのエラーが発生したため送信が出来ませんでした。しばらく経ってから<a>もう一度送信</a>してください。ドキュメントの品質向上のために時間を割いて頂き誠にありがとうございます。

閉じる

キャンセル

マニュアルに切り替える
public static function TagField(tag: string, params options: GUILayoutOption[]): string;
public static string TagField(string tag, params GUILayoutOption[] options);
public static function TagField(tag: string, style: GUIStyle, params options: GUILayoutOption[]): string;
public static string TagField(string tag, GUIStyle style, params GUILayoutOption[] options);
public static function TagField(label: string, tag: string, params options: GUILayoutOption[]): string;
public static string TagField(string label, string tag, params GUILayoutOption[] options);
public static function TagField(label: string, tag: string, style: GUIStyle, params options: GUILayoutOption[]): string;
public static string TagField(string label, string tag, GUIStyle style, params GUILayoutOption[] options);
public static function TagField(label: GUIContent, tag: string, params options: GUILayoutOption[]): string;
public static string TagField(GUIContent label, string tag, params GUILayoutOption[] options);
public static function TagField(label: GUIContent, tag: string, style: GUIStyle, params options: GUILayoutOption[]): string;
public static string TagField(GUIContent label, string tag, GUIStyle style, params GUILayoutOption[] options);

パラメーター

label フィールドのラベル
tag フィールドに表示するタグ
style オプションの GUIStyle
options 特別なレイアウト対応をするためのレイアウトオプションリスト。ここに渡された値は style で定義された設定を上書きします。
See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

戻り値

string ユーザーによって設定された値

説明

タグを選択するフィールドを作成します。


"選択した GameObjects のタグを割り当てます。”

	// Simple editor script that lets you set a tag for the selected GameObjects.
	
	class EditorGUILayoutTagField extends EditorWindow {
	
		var tagStr = "";
		@MenuItem("Examples/Set Tags For Selection")
		static function Init() {
			var window = GetWindow(EditorGUILayoutTagField);
			window.Show();
		}
		//Disable menu if we dont have at least 1 gameobject selected
		@MenuItem("Examples/Set Tags For Selection", true)
		static function ValidateSelection() {
			return	Selection.activeGameObject != null;
		}
		
		function OnGUI() {
			tagStr = EditorGUILayout.TagField("Tag for Objects:",tagStr);
			if(GUILayout.Button("Set Tag!"))
				SetTags();
		}
		function SetTags() {
			for(var go : GameObject in Selection.gameObjects)
				go.tag = tagStr;
		}
	}