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

LinePresenter

A Dialogue Presenter that presents lines of dialogue, using Unity UI elements.
public sealed class LinePresenter : DialoguePresenterBase

Inherits from Yarn.Unity.DialoguePresenterBase

#Fields

#autoAdvance

Controls whether this Line View will automatically to the Dialogue Runner that the line is complete as soon as the line has finished appearing.
public bool autoAdvance = false;

Type Boolean

If this value is true, the Line View will

The DialogueRunner will not proceed to the next piece of content (e.g. the next line, or the next options) until all Dialogue Presenters have reported that they have finished presenting their lines. If a LinePresenter doesn't report that it's finished until it receives input, the DialogueRunner will end up pausing.

This is useful for games in which you want the player to be able to read lines of dialogue at their own pace, and give them control over when to advance to the next line.

#autoAdvanceDelay

The amount of time after the line finishes appearing before automatically ending the line, in seconds.
public float autoAdvanceDelay = 1f;

Type Single

This value is only used when autoAdvance is true.

#canvasGroup

The canvas group that contains the UI elements used by this Line View.
public CanvasGroup? canvasGroup;

Type Nullable

If useFadeEffect is true, then the alpha value of this CanvasGroup will be animated during line presentation and dismissal.

See also

#characterNameContainer

The game object that holds the characterNameText text field.
public GameObject? characterNameContainer = null;

Type Nullable

This is needed in situations where the character name is contained within an entirely different game object. Most of the time this will just be the same game object as characterNameText.

#characterNameText

The TMP_Text object that displays the character names found in dialogue lines.
public TMP_Text? characterNameText = null;

Type Nullable

If the LinePresenter receives a line that does not contain a character name, this object will be left blank.

#customTypewriter

Provides a mechanism to connect a typewriter up to this presenter.
public InterfaceContainer<IAsyncTypewriter>? customTypewriter;

Type InterfaceContainer

This uses the InterfaceContainer class to provide a wrapper around an interface, otherwise all typewriters would need to be monobehaviours

#fadeDownDuration

The time that the fade effect will take to fade lines out.
public float fadeDownDuration = 0.1f;

Type Single

This value is only used when useFadeEffect is true.

See also

#fadeUpDuration

The time that the fade effect will take to fade lines in.
public float fadeUpDuration = 0.25f;

Type Single

This value is only used when useFadeEffect is true.

See also

#lettersPerSecond

The number of characters per second that should appear during a typewriter effect.
public int lettersPerSecond = 60;

Type Int32

#lineText

The TMP_Text object that displays the text of dialogue lines.
public TMP_Text? lineText;

Type Nullable

#showCharacterNameInLine

Controls whether the lineText object will show the character name present in the line or not.
public bool showCharacterNameInLine = true;

Type Boolean

This value is only used if characterNameText is null.

If this value is true, any character names present in a line will be shown in the lineText object.

If this value is false, character names will not be shown in the lineText object.

#useFadeEffect

Controls whether the line view should fade in when lines appear, and fade out when lines disappear.
public bool useFadeEffect = true;

Type Boolean

If this value is true, the canvasGroup object's alpha property will animate from 0 to 1 over the course of fadeUpDuration seconds when lines appear, and animate from 1 to zero over the course of fadeDownDuration seconds when lines disappear.

If this value is false, the canvasGroup object will appear instantaneously.

See also

#wordsPerSecond

public int wordsPerSecond = 10;

Type Int32

#Methods

#OnDialogueCompleteAsync(CancellationToken)

Called by the DialogueRunner to signal that the dialogue has ended, and no more content will be delivered.
public override YarnTask OnDialogueCompleteAsync(CancellationToken token)

Parameters

  • tokenCancellationToken
    The cancellation token for this task, if cancelled this method should finish as soon as possible.

Returns YarnTask: A task that represents any work done by this dialogue presenter in order to clean up after running dialogue.

This method is called after the last piece of content (that is, lines, options or commands) finished running.

This method is a good place to perform tasks like dismissing on-screen dialogue UI (for example, turning off a letterboxing effect, or hiding dialogue UI elements.)

The default implementation of this method does nothing.

#OnDialogueStartedAsync(CancellationToken)

Called by the DialogueRunner to signal that dialogue has started.
public override YarnTask OnDialogueStartedAsync(CancellationToken token)

Parameters

  • tokenCancellationToken
    The cancellation token for this task, if cancelled this method should finish as soon as possible.

Returns YarnTask: A task that represents any work done by this dialogue presenter in order to get ready for dialogue to run.

This method is called before any content (that is, lines, options or commands) are delivered.

This method is a good place to perform tasks like preparing on-screen dialogue UI (for example, turning on a letterboxing effect, or making dialogue UI elements visible.)

The default implementation of this method does nothing.

#RunLineAsync(LocalizedLine, LineCancellationToken)

Presents a line using the configured text view.
public override async YarnTask RunLineAsync(LocalizedLine line, LineCancellationToken token)

Parameters

Returns YarnTask: A task that completes when the dialogue presenter has finished showing the line to the user.

Generated from Yarn Spinner for Unity 3.3.