LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

This version of Unity is unsupported.

GUI.HorizontalSlider

public static method HorizontalSlider(position: Rect, value: float, leftValue: float, rightValue: float): float;
public static method HorizontalSlider(position: Rect, value: float, leftValue: float, rightValue: float, slider: GUIStyle, thumb: GUIStyle): float;

Parameters

positionRectangle on the screen to use for the slider.
valueThe value the slider shows. This determines the position of the draggable thumb.
leftValueThe value at the left end of the slider.
rightValueThe value at the right end of the slider.
sliderThe GUIStyle to use for displaying the dragging area. If left out, the horizontalSlider style from the current GUISkin is used.
thumbThe GUIStyle to use for displaying draggable thumb. If left out, the horizontalSliderThumb style from the current GUISkin is used.

Returns

float The value that has been set by the user.

Description

A horizontal slider the user can drag to change a value between a min and a max.

no example available in JavaScript