お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
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.
Closeposition | スライダーを描画するスクリーン上のRect |
value | スライダーの表示位置。ドラッグ可能なつまみの位置を決定します |
leftValue | スライダーの左端の値 |
rightValue | スライダーの右端の値 |
slider | ドラッグする領域を表示するために使用するGUIStyle。省略された場合は、現在のGUISkinにある horizontalSlider スタイルを使用します。 |
thumb | ドラッグするつまみを表示するために使用するGUIStyle。省略された場合は、現在のGUISkinにある horizontalSliderThumb スタイルを使用します。 |
float ユーザーによって設定された値
ユーザーが最小値と最大値の間で値をドラッグで変更できる水平スライダー
// Draws a horizontal slider control that goes from 0 to 10. var hSliderValue : float = 0.0; function OnGUI () { hSliderValue = GUI.HorizontalSlider (Rect (25, 25, 100, 30), hSliderValue, 0.0, 10.0); }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public float hSliderValue = 0.0F; void OnGUI() { hSliderValue = GUI.HorizontalSlider(new Rect(25, 25, 100, 30), hSliderValue, 0.0F, 10.0F); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): public hSliderValue as float = 0.0F def OnGUI() as void: hSliderValue = GUI.HorizontalSlider(Rect(25, 25, 100, 30), hSliderValue, 0.0F, 10.0F)