Skip to content

TextStudioPreview

ClassTextStudioTextStudio
public sealed class TextStudioPreview

Preview controller attached to a TextStudio.TextStudioText hub. Exposes Play / Pause / Restart / Scrub / ShowEndState operations that work identically in edit and play mode. In edit mode the hub drives ticks via EditorApplication.update; in play mode they come from LateUpdate. Either way, the same knobs apply.

End-state preview (edit mode default). While `TextStudio.TextStudioPreview.ShowEndState` is true the hub auto-snaps reveal to fully revealed every time text or layout changes, so authors see the final placement + animation while they type. Pressing Play / Restart / Scrub turns end-state preview off and the timed pipeline takes over. `TextStudio.TextStudioPreview.ShowEndStateAgain` returns to authoring mode. End-state preview is ignored in play mode - runtime code is in charge there.

public TextStudioPreview(TextStudioText hub)

Creates a preview controller for the supplied Text Studio component. In edit mode, construction suppresses authored reveal looping until the preview returns control to normal authoring.

Parameters

Name Type Description
hub TextStudio.TextStudioText The component whose compiled text and playback state will be previewed.

IsSegmentEnabled(TextStudioPreviewSegment)

Section titled “IsSegmentEnabled(TextStudioPreviewSegment)”
public bool IsSegmentEnabled(TextStudioPreviewSegment segment)

Determines whether any of the requested lifecycle segments participate in the preview.

Parameters

Name Type
segment TextStudio.TextStudioPreviewSegment

Returns

System.Boolean

public void SetSegments(TextStudioPreviewSegment segments)

Replaces the preview lifecycle selection and reconciles an active preview without changing the component’s authored typewriter settings.

Parameters

Name Type
segments TextStudio.TextStudioPreviewSegment

SetSegmentEnabled(TextStudioPreviewSegment, bool)

Section titled “SetSegmentEnabled(TextStudioPreviewSegment, bool)”
public void SetSegmentEnabled(TextStudioPreviewSegment segment, bool enabled)

Adds or removes lifecycle segments from the preview selection. Unknown flag values are ignored and an empty selection is normalized by the preview.

Parameters

Name Type
segment TextStudio.TextStudioPreviewSegment
enabled System.Boolean
public void Play()

Start or resume timed preview playback through the selected segments.

public void Pause()

Pause the preview timer without touching progress.

public void Restart()

Fully reset reveal + effects so a replay produces identical output from glyph 0. Starts playback immediately from the selected preview start.

public void Hide()

Play the hide/disappearance phase once without enabling the Hide preview segment.

public void Scrub(float normalized)

Jump full preview progress to a normalized point (0..1). Disables timed playback.

Parameters

Name Type
normalized System.Single
public void ClearScrub()

Cancel scrub mode and hand the reveal back to the timer.

public void ShowEndStateAgain()

Return to authoring mode: snap reveal to fully revealed and re-enable auto-snap on every subsequent text/layout change. The preview is paused afterwards so further edits keep showing the end state.

public bool IsPlaying { get; }

True when the preview timer is actively advancing.

Returns

System.Boolean

public float Time { get; }

Elapsed preview time in seconds.

Returns

System.Single

public float Progress { get; }

Current normalized preview position across the selected reveal, active, and hide segments.

Returns

System.Single

public bool IsScrubbing { get; }

True when the preview is in manual scrub mode (progress driven by user).

Returns

System.Boolean

public float ScrubProgress { get; }

Current full preview scrubber value (0..1). Only meaningful when TextStudio.TextStudioPreview.IsScrubbing.

Returns

System.Single

public bool ShowEndState { get; }

True while the hub should auto-snap reveal to the end state on every text or layout change. Default true; cleared automatically by Play/Restart/Scrub and re-enabled by TextStudio.TextStudioPreview.ShowEndStateAgain.

Returns

System.Boolean

public TextStudioPreviewSegment EnabledSegments { get; }

Returns

TextStudio.TextStudioPreviewSegment

public bool Repeat { get; set; }

Repeat the selected preview lifecycle without changing authored typewriter playback.

Returns

System.Boolean

public float PlaybackSpeed { get; set; }

Transient speed applied to the complete preview lifecycle.

Returns

System.Single

public int ActiveDurationMultiplier { get; set; }

Preview-only multiplier for the sampled Active phase duration.

Returns

System.Int32

public float ActiveDuration { get; }

Returns

System.Single