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

スクリプト言語

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

GUILayout.VerticalScrollbar

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function VerticalScrollbar(value: float, size: float, topValue: float, bottomValue: float, style: GUIStyle, params options: GUILayoutOption[]): float;
public static float VerticalScrollbar(float value, float size, float topValue, float bottomValue, GUIStyle style, params GUILayoutOption[] options);
public static def VerticalScrollbar(value as float, size as float, topValue as float, bottomValue as float, style as GUIStyle, *options as GUILayoutOption[]) as float

Parameters

value 最小値と最大値の間にある値
size つまみのサイズ
topValue スクロールバーの上端の値
bottomValue スクロールバーの下端の値
style スクロールバーの背景に使用するスタイル。省略された場合は、現在のGUISkinにある horizontalScrollbar スタイルを使用します。
options 特別なレイアウトプロパティのオプションリスト。ここに渡された値で style で定義された設定を上書きします。

Returns

float 変更された value 。これはユーザーによってスクロールバーをドラッグ、またはバーの矢印をクリックして変更したときに変更されます。

Description

垂直のスクロールバー

スクロールバーコントロールはバーの"つまみ"をドラッグして位置を表すfloat値を返します。他のGUI要素をスクロールの位置に合わせるために使用することが出来ます。しかし、大抵はスクロールビューのコントロールを使用することで簡単に扱うことが出来ます。
ゲームビューの垂直スクロールバー

	var vSbarValue : float;

	function OnGUI () {
		vSbarValue = GUILayout.VerticalScrollbar(vSbarValue, 1.0, 10.0, 0.0);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public float vSbarValue;
    void OnGUI() {
        vSbarValue = GUILayout.VerticalScrollbar(vSbarValue, 1.0F, 10.0F, 0.0F);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public vSbarValue as float

	def OnGUI() as void:
		vSbarValue = GUILayout.VerticalScrollbar(vSbarValue, 1.0F, 10.0F, 0.0F)

スクロールボタンの端のバーのスタイルは現在のスタイルに"upbutton" または "downbutton" を追加することに寄って取得できます。スクロールバーのつまみ(ドラッグする部分)はスタイル名に"thumb"を追加することで取得できます。

	var scrollPos : float = 0.5;
	// This will use the following style names to determine the size / placement of the buttons
	// MyVerticalScrollbarupbutton    - Name of style used for the up button.
	// MyVerticalScrollbardownbutton - Name of style used for the down button.
	// MyVerticalScrollbarthumb         - Name of style used for the draggable thumb.
	function OnGUI() {
		scrollPos = GUILayout.HorizontalScrollbar (scrollPos, 1, 0, 100, "MyVerticalScrollbar");
	}