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

スクリプト言語

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

GUI.RepeatButton

public static function RepeatButton(position: Rect, content: GUIContent, style: GUIStyle): bool;

Parameters

position ボタンに使用するスクリーン上のRect
text ボタン上に表示するテキスト
image ボタン上に表示するTexture
content ボタンのテキスト、画像、ツールチップ
style 使用するスタイル。省略された場合は、現在のGUISkinにある button スタイルを使用します。

Returns

bool ユーザーがボタンをクリックしたときにtrueを返します

Description

ユーザがボタンを押し続けている限りtrueを返すボタン

	// Draws 2 buttons, one with an image, and other with a text
	// And print a message when they got clicked.
	var btnTexture : Texture;
	function OnGUI() {
		if (!btnTexture) {
			Debug.LogError("Please assign a texture on the inspector");
			return;
		}
		if (GUI.RepeatButton(Rect(10,10,50,50),btnTexture))
			Debug.Log("Clicked the button with an image");

		if (GUI.RepeatButton(Rect(10,70,50,30),"Click"))
			Debug.Log("Clicked the button with text");
	}