TextStudioPreview
public sealed class TextStudioPreviewPreview 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.
Constructors
Section titled “Constructors”
TextStudioPreview(TextStudioText)
Section titled “TextStudioPreview(TextStudioText)”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. |
Methods
Section titled “Methods”
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
SetSegments(TextStudioPreviewSegment)
Section titled “SetSegments(TextStudioPreviewSegment)”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 |
Play()
Section titled “Play()”public void Play()Start or resume timed preview playback through the selected segments.
Pause()
Section titled “Pause()”public void Pause()Pause the preview timer without touching progress.
Restart()
Section titled “Restart()”public void Restart()Fully reset reveal + effects so a replay produces identical output from glyph 0. Starts playback immediately from the selected preview start.
Hide()
Section titled “Hide()”public void Hide()Play the hide/disappearance phase once without enabling the Hide preview segment.
Scrub(float)
Section titled “Scrub(float)”public void Scrub(float normalized)Jump full preview progress to a normalized point (0..1). Disables timed playback.
Parameters
| Name | Type |
|---|---|
normalized |
System.Single |
ClearScrub()
Section titled “ClearScrub()”public void ClearScrub()Cancel scrub mode and hand the reveal back to the timer.
ShowEndStateAgain()
Section titled “ShowEndStateAgain()”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.
Properties
Section titled “Properties”
IsPlaying
Section titled “IsPlaying”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
Progress
Section titled “Progress”public float Progress { get; }Current normalized preview position across the selected reveal, active, and hide segments.
Returns
System.Single
IsScrubbing
Section titled “IsScrubbing”public bool IsScrubbing { get; }True when the preview is in manual scrub mode (progress driven by user).
Returns
System.Boolean
ScrubProgress
Section titled “ScrubProgress”public float ScrubProgress { get; }Current full preview scrubber value (0..1). Only meaningful when TextStudio.TextStudioPreview.IsScrubbing.
Returns
System.Single
ShowEndState
Section titled “ShowEndState”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
EnabledSegments
Section titled “EnabledSegments”public TextStudioPreviewSegment EnabledSegments { get; }Returns
TextStudio.TextStudioPreviewSegment
Repeat
Section titled “Repeat”public bool Repeat { get; set; }Repeat the selected preview lifecycle without changing authored typewriter playback.
Returns
System.Boolean
PlaybackSpeed
Section titled “PlaybackSpeed”public float PlaybackSpeed { get; set; }Transient speed applied to the complete preview lifecycle.
Returns
System.Single
ActiveDurationMultiplier
Section titled “ActiveDurationMultiplier”public int ActiveDurationMultiplier { get; set; }Preview-only multiplier for the sampled Active phase duration.
Returns
System.Int32
ActiveDuration
Section titled “ActiveDuration”public float ActiveDuration { get; }Returns
System.Single