ScrollView
Displays its contents inside a scrollable frame. For more information, see ScrollView.
Read time 8 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
- Inherits from: VisualElement
- Implements: IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler
public class ScrollView : VisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler
Static Fields
Value | Description |
|---|---|
| contentAndVerticalScrollUssClassName | USS class name of content elements in elements of this type. |
| contentUssClassName | USS class name of content elements in elements of this type. |
| horizontalVariantContentUssClassName | USS class name that's added when the ContentContainer is in horizontal mode. ScrollViewMode.Horizontal |
| horizontalVariantUssClassName | USS class name that's added when the ScrollView is in horizontal mode. ScrollViewMode.Horizontal |
| horizontalVariantViewportUssClassName | USS class name that's added when the Viewport is in horizontal mode. ScrollViewMode.Horizontal |
| hScrollerUssClassName | USS class name of horizontal scrollers in elements of this type. |
| ussClassName | USS class name of elements of this type. |
| verticalHorizontalVariantContentUssClassName | USS class name that's added when the ContentContainer is in both horizontal and vertical mode. ScrollViewMode.VerticalAndHorizontal |
| verticalHorizontalVariantUssClassName | USS class name that's added when the ScrollView is in both horizontal and vertical mode. ScrollViewMode.VerticalAndHorizontal |
| verticalHorizontalVariantViewportUssClassName | USS class name that's added when the Viewport is in both horizontal and vertical mode. ScrollViewMode.VerticalAndHorizontal |
| verticalVariantContentUssClassName | USS class name that's added when the ContentContainer is in vertical mode. ScrollViewMode.Vertical |
| verticalVariantUssClassName | USS class name that's added when the ScrollView is in vertical mode. ScrollViewMode.Vertical |
| verticalVariantViewportUssClassName | USS class name that's added when the Viewport is in vertical mode. ScrollViewMode.Vertical |
| viewportUssClassName | USS class name of viewport elements in elements of this type. |
| vScrollerUssClassName | USS class name of vertical scrollers in elements of this type. |
Constructors
Constructor | Description |
|---|---|
| ScrollView() | Constructor. |
| ScrollView(UnityEngine.UIElements.ScrollViewMode) | Constructor. |
Properties
Property | Description |
|---|---|
| contentContainer | Contains full content, potentially partially visible. |
| contentViewport | Represents the visible part of contentContainer. |
| elasticAnimationIntervalMs | The minimum amount of time, in milliseconds, between executions of elastic spring animation. |
| elasticity | The amount of elasticity to use when a user tries to scroll past the boundaries of the scroll view. |
| horizontalPageSize | This property controls the speed of the horizontal scrolling when using a keyboard or the on-screen scrollbar buttons (arrows and handle), based on the size of the page. |
| horizontalScroller | Horizontal scrollbar. |
| horizontalScrollerVisibility | Specifies whether the horizontal scroll bar is visible. |
| mode | Controls how the ScrollView allows the user to scroll the contents. ScrollViewMode |
| mouseWheelScrollSize | This property controls the scrolling speed only when using a mouse scroll wheel, based on the size of the page. It takes precedence over the --unity-metrics-single_line-height USS variable. |
| nestedInteractionKind | The behavior to use when scrolling reaches limits of a nested ScrollView. |
| scrollDecelerationRate | Controls the rate at which the scrolling movement slows after a user scrolls using a touch interaction. |
| scrollOffset | The current scrolling position. |
| touchScrollBehavior | The behavior to use when a user tries to scroll past the boundaries of the ScrollView content using a touch interaction. |
| verticalPageSize | This property controls the speed of the vertical scrolling when using a keyboard or the on-screen scrollbar buttons (arrows and handle), based on the size of the page. |
| verticalScroller | Gets the vertical scrollbar for the scroll view. |
| verticalScrollerVisibility | Specifies whether the vertical scroll bar is visible. |
Methods
Method | Description |
|---|---|
| ScrollTo | Scroll to a specific child element. |
Enums
Enum | Description |
|---|---|
| ScrollView.NestedInteractionKind | Options for controlling how nested ScrollView handles scrolling when reaching the limits of the scrollable area. |
| ScrollView.TouchScrollBehavior | The behavior to use when a user tries to scroll past the end of the ScrollView content using a touch interaction. |