Skip to content

Scroll Snap

Ilia Petrov-Komotskii edited this page Oct 7, 2026 · 3 revisions

Helpers for ScrollRect.

Snap

Moves content so a child sits at the content origin, plus an optional offset. Calls Canvas.ForceUpdateCanvases() first.

using Mane.Unity.UI;
using UnityEngine.UI;

scroll.SnapTo(row.transform);
scroll.SnapTo(row.transform, new Vector2(0f, 12f));
scroll.SnapXTo(row.transform, 8f);
scroll.SnapYTo(row.transform);

SnapTo keeps the current position on axes that are not enabled (horizontal / vertical). SnapXTo / SnapYTo only write that axis.

Clone this wiki locally