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).

IActionMarkupHandler

A IActionMarkupHandler is an object that reacts to the delivery of a line of dialogue, and can optionally control the timing of that delivery.
public interface IActionMarkupHandler

There are a number of cases where a line's delivery needs to have its timing controlled. For example, PauseEventProcessor adds a small delay between each character, creating a 'typewriter' effect as each letter appears over time.

Another example of a IActionMarkupHandler is an in-line event or animation, such as causing a character to play an animation (and waiting for that animation to complete before displaying the rest of the line).

#Methods

#OnCharacterWillAppear(int, MarkupParseResult, CancellationToken)

Called repeatedly for each visible character in the line.
public YarnTask OnCharacterWillAppear(int currentCharacterIndex, MarkupParseResult line, CancellationToken cancellationToken);

Parameters

  • currentCharacterIndexint
    The zero-based index of the character being displayed.
  • text(unknown)
    A TMP_Text object that the line is being displayed in.
  • cancellationTokenCancellationToken
    A cancellation token representing whether the

Returns YarnTask: A task that completes when the ActionMarkupHandler has completed presenting this character. Dialogue presenters will wait until this task is complete before displaying the remainder of the line.

This method is a ActionMarkupHandler object's main opportunity to take action during line display.

#OnLineDisplayBegin(MarkupParseResult, TMP_Text)

Called immediately before the first character in the line is presented.
public void OnLineDisplayBegin(MarkupParseResult line, TMP_Text text);

Parameters

  • The line being presented.
  • textTMP_Text
    A TMP_Text object that the line is being displayed in.

#OnLineDisplayComplete()

Called after the last call to PresentCharacter(int, TMP_Text, CancellationToken).
public void OnLineDisplayComplete();
This method is an opportunity for a ActionMarkupHandler to finalise its presentation after all of the characters in the line have been presented.

#OnLineWillDismiss()

Called right before the line will dismiss itself.
public void OnLineWillDismiss();
This does not mean that the entirety of the view itself will have been removed, just the DialoguePresenterBase has completed displaying everything and is returning control back to the DialogueRunner to let more content flow.

#OnPrepareForLine(MarkupParseResult, TMP_Text)

Called when the line view receives the line, to prepare for showing the line.
public void OnPrepareForLine(MarkupParseResult line, TMP_Text text);

Parameters

  • The line being presented.
  • textTMP_Text
    A TMP_Text object that the line is being displayed in.
This method is called before any part of the line is visible, and is an opportunity to set up any part of the ActionMarkupHandler's display before the user can see it.

Generated from Yarn Spinner for Unity 3.3.