Class Scroller
A vertical or horizontal scrollbar.
Inherited Members
Namespace: UnityEngine.UIElements
Syntax
public class Scroller : VisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle
Constructors
Scroller()
Constructor.
Declaration
public Scroller()
Scroller(Single, Single, System.Action<Single>, SliderDirection)
Constructor.
Declaration
public Scroller(float lowValue, float highValue, System.Action<float> valueChanged, SliderDirection direction = SliderDirection.Vertical)
Parameters
Type | Name | Description |
---|---|---|
Single | lowValue | |
Single | highValue | |
System.Action<Single> | valueChanged | |
SliderDirection | direction |
Fields
highButtonUssClassName
USS class name of high buttons in elements of this type.
Declaration
public static readonly string highButtonUssClassName
Field Value
Type | Description |
---|---|
String |
horizontalVariantUssClassName
USS class name of elements of this type, when they are displayed horizontally.
Declaration
public static readonly string horizontalVariantUssClassName
Field Value
Type | Description |
---|---|
String |
lowButtonUssClassName
USS class name of low buttons in elements of this type.
Declaration
public static readonly string lowButtonUssClassName
Field Value
Type | Description |
---|---|
String |
sliderUssClassName
USS class name of slider elements in elements of this type.
Declaration
public static readonly string sliderUssClassName
Field Value
Type | Description |
---|---|
String |
ussClassName
USS class name of elements of this type.
Declaration
public static readonly string ussClassName
Field Value
Type | Description |
---|---|
String |
verticalVariantUssClassName
USS class name of elements of this type, when they are displayed vertically.
Declaration
public static readonly string verticalVariantUssClassName
Field Value
Type | Description |
---|---|
String |
Properties
direction
Direction of this scrollbar.
Declaration
public SliderDirection direction { get; set; }
Property Value
Type | Description |
---|---|
SliderDirection |
highButton
Top or right scroll button.
Declaration
public RepeatButton highButton { get; }
Property Value
Type | Description |
---|---|
RepeatButton |
highValue
Maximum value.
Declaration
public float highValue { get; set; }
Property Value
Type | Description |
---|---|
Single |
lowButton
Bottom or left scroll button.
Declaration
public RepeatButton lowButton { get; }
Property Value
Type | Description |
---|---|
RepeatButton |
lowValue
Minimum value.
Declaration
public float lowValue { get; set; }
Property Value
Type | Description |
---|---|
Single |
slider
The slider used by this scroller.
Declaration
public Slider slider { get; }
Property Value
Type | Description |
---|---|
Slider |
value
Declaration
public float value { get; set; }
Property Value
Type | Description |
---|---|
Single |
Methods
Adjust(Single)
Updates the slider element size as a ratio of total range. A value greater than 1 will disable the Scroller.
Declaration
public void Adjust(float factor)
Parameters
Type | Name | Description |
---|---|---|
Single | factor | Slider size ratio. |
ScrollPageDown()
Will change the value according to the current slider pageSize.
Declaration
public void ScrollPageDown()
ScrollPageDown(Single)
Will change the value according to the current slider pageSize.
Declaration
public void ScrollPageDown(float factor)
Parameters
Type | Name | Description |
---|---|---|
Single | factor |
ScrollPageUp()
Will change the value according to the current slider pageSize.
Declaration
public void ScrollPageUp()
ScrollPageUp(Single)
Will change the value according to the current slider pageSize.
Declaration
public void ScrollPageUp(float factor)
Parameters
Type | Name | Description |
---|---|---|
Single | factor |
Events
valueChanged
Event sent when the slider value has changed.
Declaration
public event System.Action<float> valueChanged
Event Type
Type | Description |
---|---|
System.Action<Single> |