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

YarnOptionsPresenter

Built-in presenter for displaying dialogue options. Creates buttons for each option and handles selection.
class_name YarnOptionsPresenter
extends YarnDialoguePresenter

Inherits from YarnDialoguePresenter

When show_last_line is enabled, the most recent dialogue line is shown above the options. The [lastline] markup tag can be used to truncate the displayed text at that point.

#Constants

#LASTLINE_MARKUP

const LASTLINE_MARKUP = "lastline"

#Properties

#fade_down_duration

var fade_down_duration: float = 0.1

Type float

#fade_up_duration

var fade_up_duration: float = 0.25

Type float

#hide_unavailable

Hide options whose is_available is false (instead of showing them greyed out).
var hide_unavailable: bool = true

Type bool

#last_line_character_name_container

Container for the character name (hidden when line has no character).
var last_line_character_name_container: Control

Type Control

#last_line_character_name_text

Label for the character name of the last line.
var last_line_character_name_text: Control

Type Control

#last_line_container

Container holding the last line display (hidden when no last line).
var last_line_container: Control

Type Control

#last_line_text

Label or RichTextLabel to display the last line's text. Only used when show_last_line is enabled.
var last_line_text: Control

Type Control

#option_action_prefix

Input action prefix for keyboard shortcuts (e.g. "option_" → "option_1", "option_2").
var option_action_prefix: String = ""

Type String

#option_button_scene

Scene instantiated per option. The root may be a YarnOptionItem (preferred) or any BaseButton. Edit the default scene or point this at your own to restyle options.
var option_button_scene: PackedScene = <Object>

Type PackedScene

#options_container

var options_container: Container

Type Container

#show_last_line

Show the most recent dialogue line above the options.
var show_last_line: bool = false

Type bool

#use_fade_effect

fade the panel in and out around the options.
var use_fade_effect: bool = true

Type bool

#Signals

#option_selected

signal option_selected(index: int, option: YarnOption)

Parameters

#options_shown

signal options_shown(options: Array[YarnOption])

Parameters

#Methods

#on_dialogue_completed()

func on_dialogue_completed() -> void

#on_dialogue_started()

func on_dialogue_started() -> void

#run_line(YarnLine, YarnCancellationToken)

func run_line(line: YarnLine, _token: YarnCancellationToken = null) -> void

Parameters

#run_options(Array[YarnOption], YarnCancellationToken)

func run_options(options: Array[YarnOption], token: YarnCancellationToken = null) -> int

Parameters

Returns int

Generated from Yarn Spinner for Godot GDScript 3.3.