Pardon our dust! Docs for Yarn Spinner for Unity 3.2 and Yarn Spinner for Godot C# are on docs.yarnspinner.dev (the old docs site). Docs for Yarn Spinner for Unity 3.3 (pre-release, out ASAP), Yarn Spinner for Godot GDScript and Yarn Spinner for Unreal Engine (work in progress) are on /docs/ (the new docs site).

LetterTypewriter

An implementation of IAsyncTypewriter that delivers characters one at a time, and invokes any IActionMarkupHandlers along the way as needed.
public class LetterTypewriter : IAsyncTypewriter

Inherits from System.Object

Implements Yarn.Unity.IAsyncTypewriter

#Properties

#ActionMarkupHandlers

A collection of IActionMarkupHandler objects that should be invoked as needed during the typewriter's delivery in RunTypewriter(Markup.MarkupParseResult,CancellationToken), depending upon the contents of a line.
public List<IActionMarkupHandler> ActionMarkupHandlers { get; set; }

Type List

#CharactersPerSecond

The number of characters per second to deliver.
public float CharactersPerSecond { get; set; }

Type Single

If this value is zero, all characters are delivered at once, subject to any delays added by the markup handlers in ActionMarkupHandlers.

#TextElement

The TMP_Text to display the text in.
public TMP_Text? TextElement { get; set; }

Type Nullable

#Methods

#ContentDidDismiss()

Called after the content has been visibly hidden.
public void ContentDidDismiss()
This is the typewriters last chance to do any cleanup that they may need to do before more content or full destruction occurs, will always be called after ContentWillDismiss(). It is the responsibility of the DialoguePresenterBase to only call this after hiding anything that might look weird if state is reset.

#ContentWillDismiss()

Called right before the content will be visibly hidden
public void ContentWillDismiss()

#PrepareForContent(Markup.MarkupParseResult)

Called by the presenter before content has been shown. This gives the typewriter it's chance to do any setup before the content is visibly shown.
public void PrepareForContent(Markup.MarkupParseResult line)

Parameters

#RunTypewriter(Markup.MarkupParseResult, CancellationToken)

Displays the contents of a line over time.
public async YarnTask RunTypewriter(Markup.MarkupParseResult line, CancellationToken cancellationToken)

Parameters

  • The line to display.
  • cancellationTokenSystem.Threading.CancellationToken
    A token that indicates that the typewriter effect should be cancelled.

Returns YarnTask: A task that completes when the typewriter effect has finished.

This method is called when a dialogue presenter wants to deliver a line's text. The typewriter should present the text to the user; it may take as long as it needs to do so.

If cancellationToken's System.Threading.CancellationToken.IsCancellationRequested becomes true, the typewriter effect should end early and present the entire contents of line.

Generated from Yarn Spinner for Unity 3.3.