Docsv3.12.0
Back to API Reference
Class

MarqueeModifier

Inherits:BaseModifier
Implements:IPhaseModifier

Scrolls the whole text horizontally inside its RectTransform, like a news ticker or a song title wider than its label.

Remarks

Apply whole-text: every line moves together whichever range carries the modifier, and the parameters resolve from the first applied range. The text scrolls while it is wider than its padded rect, or always with Always, and each cycle rests for Pause at the text's start edge — left for a left-to-right paragraph, right for a right-to-left one. While it scrolls, everything the text renders — glyphs, range decorations, inline objects and every copy of a loop — is clipped at the rect's left and right edges; vertical overflow stays visible. Fade softens those edges, and padding keeps resting text clear of the fade. Clicks and hover reach the moving text and each of its copies. An inline scene object in Existing mode keeps its own hierarchy: it follows the laid-out text alone and the clip does not reach it. The position is a pure function of the phase: one phase unit per second on Clock, or exactly what a driver, tween, Animator or code writes under Manual. A change of the text restarts the cycle. Canvas text only: enabling the modifier on UniTextWorld throws NotSupportedException. A text backed by a document, or one another component already scrolls, does not scroll as a marquee and reports why once per occurrence.
public MarqueeMode Mode{ get; set }

How the text moves: an endless loop of copies, or back and forth between its ends.

public UnitValue Speed{ get; set }

Travel per second, in pixels or em of the component's font size; a negative value runs the other way.

public float Pause{ get; set }

Seconds the text rests at its start edge each cycle, and at its end edge in PingPong; a negative value counts as zero.

public UnitValue Gap{ get; set }

Space between the end of the text and the start of the copy that follows it in Loop: pixels, em, or percent of the padded rect's width; a negative value counts as zero.

public bool Always{ get; set }

Whether the text scrolls even while it fits its padded rect.

public UnitValue Fade{ get; set }

Width of the soft fade inside the rect's left and right edges, in pixels or em; zero cuts sharply.

public float Phase{ get; set }

Animation input in seconds, weakest stage of the applied range's phase cascade: a driver, tween, Animator or code writes it, and the seconds Clock has run add to it.

public PlaybackClock Clock{ get; set }

Time source the phase advances on, one phase unit per second. Manual advances nothing: the text stands where the phase it resolves puts it.

protected override void OnEnable()
protected override void OnDisable()

Detaches from the pipeline and schedules a release on the next layout commit: a re-parse that keeps the modifier enables it again first and cancels the release, so the scroll carries on.

protected override void OnDestroy()
protected override void BeforeApply()
protected override void OnApply()