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

YarnLine

A line of dialogue with substitution, markup, and localisation support.
class_name YarnLine
extends RefCounted

Inherits from RefCounted

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

#Properties

#character_name

Character name extracted from [character] markup or implicit "Name:" pattern. Computed lazily alongside text.
var character_name: String

Type String

#line_id

The string table ID for this line (e.g. "line:tutorial-tom-01").
var line_id: String = ""

Type String

#locale_code

BCP-47 locale for [plural] and [ordinal] rules.
var locale_code: String = "en"

Type String

#markup_attributes

Parsed markup attributes — populated on first access to text.
var markup_attributes: Array[YarnMarkupAttribute] = []

Type Array[YarnMarkupAttribute]

#markup_result

Full markup parse result — populated on first access to text.
var markup_result: YarnMarkupParseResult = null

Type YarnMarkupParseResult

#metadata

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

Type PackedStringArray

#raw_text

Localised text before substitution — still contains {0} placeholders and markup tags. Set by the line provider.
var raw_text: String = ""

Type String

#source

Optional source that handles requests to end this line early. The dialogue runner sets this to itself when it dispatches the line to its presenters. Wrapper presenters (such as the Interruption add-on) may substitute themselves as the source so that requests from child presenters to end the line can be intercepted. A source object should implement request_line_cancellation(line: YarnLine). Presenters should route end-of-line requests through YarnDialoguePresenter._request_line_end, which uses this field if set and otherwise falls back to calling YarnDialogueRunner.signal_content_complete directly.
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. Computed lazily on first access.
var text: String

Type String

#text_without_character_name

The text with the character name prefix removed.
var text_without_character_name: String

Type String

#Methods

#apply_substitutions()

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

#delete_attribute_text(YarnMarkupAttribute)

Deletes the text covered by an attribute and re-parses.
func delete_attribute_text(attr: YarnMarkupAttribute) -> void

Parameters

#get_bbcode_text(YarnMarkupParser, bool)

Returns text with markup converted to BBCode for RichTextLabel.
func get_bbcode_text(parser: YarnMarkupParser = null, include_character_name: bool = false) -> String

Parameters

Returns String

#get_markup_result_without_character_name()

func get_markup_result_without_character_name() -> YarnMarkupParseResult

Returns YarnMarkupParseResult

#get_markup_result()

Ensures processing, then returns the full markup result.
func get_markup_result() -> YarnMarkupParseResult

Returns YarnMarkupParseResult

#get_plain_text()

Returns text_without_character_name (substitutions and markup already applied).
func get_plain_text() -> String

Returns String

#invalidate()

Force reprocessing (e.g. if raw_text or substitutions changed after creation).
func invalidate() -> void

#parse_markup()

Markup is now parsed automatically on first access to text. This method triggers processing early if needed.
func parse_markup() -> void

#set_markup_result(YarnMarkupParseResult)

func set_markup_result(result: YarnMarkupParseResult) -> void

Parameters

#text_for_attribute(YarnMarkupAttribute)

Returns the substring of text covered by an attribute.
func text_for_attribute(attr: YarnMarkupAttribute) -> String

Parameters

Returns String

#try_get_attribute(String)

Returns the first attribute with the given name, or null.
func try_get_attribute(attr_name: String) -> YarnMarkupAttribute

Parameters

  • attr_nameString

Returns YarnMarkupAttribute

Generated from Yarn Spinner for Godot GDScript 3.3.