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

YarnOption

A dialogue option that can be selected by the player.
class_name YarnOption
extends RefCounted

Inherits from RefCounted

Access text directly — substitutions are applied lazily on first access. For raw data, use raw_text and substitutions.

#Properties

#character_name

Character name from the option's "Name:" prefix, if it has one.
var character_name: String

Type String

#destination

Instruction index to jump to when selected (internal).
var destination: int = 0

Type int

#is_available

Whether this option is available for selection (false = greyed out).
var is_available: bool = true

Type bool

#line_id

The string table ID for this option's text.
var line_id: String = ""

Type String

#locale_code

BCP-47 locale for [plural] and [ordinal] rules. Set by the line provider.
var locale_code: String = "en"

Type String

#markup_attributes

var markup_attributes: Array[YarnMarkupAttribute] = []

Type Array[YarnMarkupAttribute]

#markup_result

var markup_result: YarnMarkupParseResult = null

Type YarnMarkupParseResult

#metadata

#hashtag metadata from the yarn source.
var metadata: PackedStringArray = PackedStringArray()

Type PackedStringArray

#option_index

Index of this option in the option set (0-based).
var option_index: int = 0

Type int

#raw_text

Localised text before substitution — still contains {0} placeholders.
var raw_text: String = ""

Type String

#source

var source: Object = null

Type Object

#substitutions

Values replacing {0}, {1}, etc. placeholders in raw_text.
var substitutions: Array[String] = []

Type Array[String]

#text

Final text after substitution and markup processing (select, plural, and ordinal markers resolve here, the same as YarnLine.text). Computed lazily on first access.
var text: String

Type String

#text_without_character_name

The option text with any character name prefix removed and markup processed, matching YarnLine.text_without_character_name.
var text_without_character_name: String

Type String

#Methods

#apply_substitutions()

Substitutions are now applied automatically on first access to text. This method triggers processing early if needed.
func apply_substitutions() -> void

#get_markup_result_without_character_name()

func get_markup_result_without_character_name() -> YarnMarkupParseResult

Returns YarnMarkupParseResult

#get_markup_result()

func get_markup_result() -> YarnMarkupParseResult

Returns YarnMarkupParseResult

#get_plain_text()

Returns the option text with markup tags stripped.
func get_plain_text() -> String

Returns String

#set_markup_result(YarnMarkupParseResult)

func set_markup_result(result: YarnMarkupParseResult) -> void

Parameters

#try_get_attribute(String)

func try_get_attribute(attr_name: String) -> YarnMarkupAttribute

Parameters

  • attr_nameString

Returns YarnMarkupAttribute

Generated from Yarn Spinner for Godot GDScript 3.3.