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

スクリプト言語

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

EditorGUILayout.Foldout

フィードバック

ありがとうございます

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

閉じる

送信に失敗しました

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

閉じる

キャンセル

マニュアルに切り替える
public static function Foldout(foldout: bool, content: string, style: GUIStyle = EditorStyles.foldout): bool;
public static bool Foldout(bool foldout, string content, GUIStyle style = EditorStyles.foldout);
public static function Foldout(foldout: bool, content: GUIContent, style: GUIStyle = EditorStyles.foldout): bool;
public static bool Foldout(bool foldout, GUIContent content, GUIStyle style = EditorStyles.foldout);
public static function Foldout(foldout: bool, content: string, style: GUIStyle = EditorStyles.foldout): bool;
public static bool Foldout(bool foldout, string content, GUIStyle style = EditorStyles.foldout);
public static function Foldout(foldout: bool, content: GUIContent, style: GUIStyle = EditorStyles.foldout): bool;
public static bool Foldout(bool foldout, GUIContent content, GUIStyle style = EditorStyles.foldout);

パラメーター

foldout 表示されている折りたたみの状態
content 表示するラベル
style オプションの GUIStyle

戻り値

bool ユーザーによって選択された折りたたみの状態。 True の場合、サブオブジェクトを表示する必要があります。

説明

その左側に折りたたみ矢印でラベルを作成します。

これは親が折りたたまれており、子オブジェクトを表示するような構造のツリーやフォルダーを作成するために便利です。


" 選択した Transform を非表示か表示する折りたたみメニューを作成します。"

	// Create a foldable menu that hides/shows the selected transform
	// position.
	// if no Transform is selected, the Foldout item will be folded until
	// a transform is selected.
	
	class FoldoutUsage extends EditorWindow {
	
		var showPosition : boolean = true;
		var status : String = "Select a GameObject";
		@MenuItem("Examples/Foldout Usage")
		static function Init() {
			var window = GetWindow(FoldoutUsage);
			window.Show();
		}
		
		function OnGUI() {
			showPosition = EditorGUILayout.Foldout(showPosition, status);
			if(showPosition)
				if(Selection.activeTransform) {
					Selection.activeTransform.position = 
						EditorGUILayout.Vector3Field("Position", Selection.activeTransform.position);
						status = Selection.activeTransform.name;
				}
			
			if(!Selection.activeTransform) {
				status = "Select a GameObject";
				showPosition = false;	
			}
		}
		function OnInspectorUpdate() {
			this.Repaint();
		}
	}