Class ScrollView
Displays its contents inside a scrollable frame.
Inherited Members
Namespace: UnityEngine.UIElements
Syntax
public class ScrollView : VisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle
Constructors
ScrollView()
Constructor.
Declaration
public ScrollView()
ScrollView(ScrollViewMode)
Constructor.
Declaration
public ScrollView(ScrollViewMode scrollViewMode)
Parameters
Type | Name | Description |
---|---|---|
ScrollViewMode | scrollViewMode |
Fields
contentAndVerticalScrollUssClassName
USS class name of content elements in elements of this type.
Declaration
public static readonly string contentAndVerticalScrollUssClassName
Field Value
Type | Description |
---|---|
String |
contentUssClassName
USS class name of content elements in elements of this type.
Declaration
public static readonly string contentUssClassName
Field Value
Type | Description |
---|---|
String |
horizontalVariantUssClassName
USS class name that's added when the ScrollView is in horizontal mode. Horizontal
Declaration
public static readonly string horizontalVariantUssClassName
Field Value
Type | Description |
---|---|
String |
hScrollerUssClassName
USS class name of horizontal scrollers in elements of this type.
Declaration
public static readonly string hScrollerUssClassName
Field Value
Type | Description |
---|---|
String |
scrollVariantUssClassName
Declaration
public static readonly string scrollVariantUssClassName
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 |
verticalHorizontalVariantUssClassName
USS class name that's added when the ScrollView is in both horizontal and vertical mode. VerticalAndHorizontal
Declaration
public static readonly string verticalHorizontalVariantUssClassName
Field Value
Type | Description |
---|---|
String |
verticalVariantUssClassName
USS class name that's added when the ScrollView is in vertical mode. Vertical
Declaration
public static readonly string verticalVariantUssClassName
Field Value
Type | Description |
---|---|
String |
viewportUssClassName
USS class name of viewport elements in elements of this type.
Declaration
public static readonly string viewportUssClassName
Field Value
Type | Description |
---|---|
String |
vScrollerUssClassName
USS class name of vertical scrollers in elements of this type.
Declaration
public static readonly string vScrollerUssClassName
Field Value
Type | Description |
---|---|
String |
Properties
contentContainer
Contains full content, potentially partially visible.
Declaration
public override VisualElement contentContainer { get; }
Property Value
Type | Description |
---|---|
VisualElement |
Overrides
contentViewport
Represents the visible part of contentContainer.
Declaration
public VisualElement contentViewport { get; }
Property Value
Type | Description |
---|---|
VisualElement |
elasticity
The amount of elasticity to use when a user tries to scroll past the boundaries of the scroll view.
Declaration
public float elasticity { get; set; }
Property Value
Type | Description |
---|---|
Single |
Remarks
Elasticity is only used when touchScrollBehavior is set to Elastic.
horizontalPageSize
This property is controlling the scrolling speed of the horizontal scroller.
Declaration
public float horizontalPageSize { get; set; }
Property Value
Type | Description |
---|---|
Single |
horizontalScroller
Horizontal scrollbar.
Declaration
public Scroller horizontalScroller { get; }
Property Value
Type | Description |
---|---|
Scroller |
horizontalScrollerVisibility
Specifies whether the horizontal scroll bar is visible.
Declaration
public ScrollerVisibility horizontalScrollerVisibility { get; set; }
Property Value
Type | Description |
---|---|
ScrollerVisibility |
scrollDecelerationRate
Controls the rate at which the scrolling movement slows after a user scrolls using a touch interaction.
Declaration
public float scrollDecelerationRate { get; set; }
Property Value
Type | Description |
---|---|
Single |
Remarks
The deceleration rate is the speed reduction per second. A value of 0.5 halves the speed each second. A value of 0 stops the scrolling immediately.
scrollOffset
The current scrolling position.
Declaration
public Vector2 scrollOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
showHorizontal
Obsolete. Use horizontalScrollerVisibility instead.
Declaration
public bool showHorizontal { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
showVertical
Obsolete. Use verticalScrollerVisibility instead.
Declaration
public bool showVertical { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
touchScrollBehavior
The behavior to use when a user tries to scroll past the boundaries of the ScrollView content using a touch interaction.
Declaration
public ScrollView.TouchScrollBehavior touchScrollBehavior { get; set; }
Property Value
Type | Description |
---|---|
ScrollView.TouchScrollBehavior |
verticalPageSize
This property is controlling the scrolling speed of the vertical scroller.
Declaration
public float verticalPageSize { get; set; }
Property Value
Type | Description |
---|---|
Single |
verticalScroller
Vertical Scrollbar.
Declaration
public Scroller verticalScroller { get; }
Property Value
Type | Description |
---|---|
Scroller |
verticalScrollerVisibility
Specifies whether the vertical scroll bar is visible.
Declaration
public ScrollerVisibility verticalScrollerVisibility { get; set; }
Property Value
Type | Description |
---|---|
ScrollerVisibility |
Methods
ScrollTo(VisualElement)
Scroll to a specific child element.
Declaration
public void ScrollTo(VisualElement child)
Parameters
Type | Name | Description |
---|---|---|
VisualElement | child | The child to scroll to. |