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

スクリプト言語

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

GUILayout.Toggle

public static function Toggle(value: bool, content: GUIContent, style: GUIStyle, params options: GUILayoutOption[]): bool;

Parameters

value ボタンのon/off
text ボタン上に表示するテキスト
image ボタン上に表示するTexture
content ボタンのテキスト、画像、ツールチップ
style 使用するスタイル。省略された場合は、現在のGUISkinにある button スタイルを使用します。
options 特別なレイアウト対応をするためのレイアウトオプションリスト。ここに渡された値は style で定義された設定を上書きします。
See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

bool ボタンの新しい値

Description

on/off のトグルボタン


ゲームビューのトグルボタン

	// Draws 2 toggle controls, one with a text, the other with an image.
	var aTexture : Texture;

	private var toggleTxt : boolean = false;
	private var toggleImg : boolean = false;

	function OnGUI () {
		if(!aTexture) {
        		Debug.LogError("Please assign a texture in the inspector.");
        		return;
		}
		toggleTxt = GUILayout.Toggle(toggleTxt, "A Toggle text");
		toggleImg = GUILayout.Toggle(toggleImg, aTexture);
	}