Scroller
A vertical or horizontal scrollbar. For more information, refer to UXML element Scroller.
Read time 9 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsControlsModule
- Inherits from: VisualElement
- Implements: IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle
[UxmlElement(libraryPath = "Controls")][Icon("UIToolkit/Icons/Scroller.png")]public class Scroller : VisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle
Remarks
Each ScrollView has a Scroller for each axis, controlled by ScrollerVisibility. For more information, refer to ScrollView. If a Scroller is used in ScrollView, its Scroller.highValue and Scroller.lowValue are automatically overridden to match the ScrollView content size on GeometryChangedEvent. A Scroller contains a Slider and two RepeatButtons for scrolling.
The following example creates a scroller independently from a ScrollView:
Static Fields
Value | Description |
|---|---|
| activeSliderUssClassName | USS class name of slider elements in elements of this type. |
| highButtonUssClassName | USS class name of high buttons in elements of this type. |
| horizontalVariantUssClassName | USS class name of elements of this type, when they are displayed horizontally. |
| lowButtonUssClassName | USS class name of low buttons in elements of this type. |
| sliderUssClassName | USS class name of slider elements in elements of this type. |
| ussClassName | USS class name of elements of this type. |
| verticalVariantUssClassName | USS class name of elements of this type, when they are displayed vertically. |
Constructors
Constructor | Description |
|---|---|
| Scroller() | Constructor. |
| Scroller(System.Single,System.Single,System.Action{System.Single},UnityEngine.UIElements.SliderDirection) | Constructor. |
Properties
Property | Description |
|---|---|
| direction | Direction of this scrollbar. |
| highButton | Top or right scroll button. |
| highValue | Maximum value. |
| lowButton | Bottom or left scroll button. |
| lowValue | Minimum value. |
| slider | The slider used by this scroller. |
| value | Value that defines the slider position. It lies between Scroller.lowValue and Scroller.highValue. |
Methods
Method | Description |
|---|---|
| Adjust | Updates the slider element size as a ratio of total range. A value greater than or equal to 1 will disable the Scroller. |
| ScrollPageDown | Will change the value according to the current slider pageSize. |
| ScrollPageUp | Will change the value according to the current slider pageSize. |
Events
Member | Description |
|---|---|
| valueChanged | Event sent when the slider value has changed. |