Unity UI Extensions

UIScrollToSelection

Automatically scrolls a ScrollRect to the currently selected UI element


Contents

1 Overview

2 Properties

3 Methods

4 Usage

5 Video Demo

6 See also

7 Credits and Donation

8 External links


Overview

A ScrollRect enhancement that automatically scrolls to the currently selected UI element, useful for keyboard/gamepad navigation.


Properties

The properties of the UIScrollToSelection control are as follows:

Property Description
Viewport Rect Transform View (boundaries/mask) rect transform. Used to check if automatic scroll to selection is required
Target Scroll Rect Scroll rect used to reach selected element
Scroll Axes Allow automatic scrolling only on these axes
Used Scroll Method MOVE_TOWARDS: stiff movement, LERP: smoothed out movement
Scroll Speed Speed at which the scroll rect moves to the selected element
End Of List Jump Scroll Speed Scroll speed used when element to select is out of “JumpOffsetThreshold” range
Jump Offset Threshold If next element to scroll to is located over this screen percentage, use “EndOfListJumpScrollSpeed” to reach this element faster
Cancel Scroll Mouse Buttons Mouse buttons that cancel the automatic scrolling
Cancel Scroll Keys Keyboard keys that cancel the automatic scrolling

Methods

This component does not expose public methods beyond inherited behaviour.


Usage

Simply add the component to a ScrollRect using:

“Add Component -> UI -> Extensions -> UIScrollToSelection”


Video Demo

N/A


See also


Credits and Donation

zero3growlithe


Sourced from