You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ilia Petrov-Komotskii edited this page Oct 11, 2026
·
3 revisions
Helpers for ScrollRect.
Snap
Moves content so a child is centered in the viewport, shifted by an optional offset (positive moves the child right / up). Unless the ScrollRect movement type is Unrestricted, the content stops at its edges, so the first and last items get as close to the center as the content allows. The result does not depend on the anchors or pivots of the content and the items. Calls Canvas.ForceUpdateCanvases() first and stops the inertia on the snapped axes.
SnapTo keeps the current position on axes that are not enabled (horizontal / vertical). SnapXTo / SnapYTo only write that axis, and do nothing when it is not enabled.