YarnOption
A dialogue option that can be selected by the player.
class_name YarnOption
extends RefCountedInherits 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: StringType String
#destination
Instruction index to jump to when selected (internal).
var destination: int = 0Type int
#is_available
Whether this option is available for selection (false = greyed out).
var is_available: bool = trueType 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] = []#markup_result
var markup_result: YarnMarkupParseResult = null#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 = 0Type int
#raw_text
Localised text before substitution — still contains {0} placeholders.
var raw_text: String = ""Type String
#source
var source: Object = nullType 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: StringType 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: StringType 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() -> YarnMarkupParseResultReturns YarnMarkupParseResult
#get_markup_result()
func get_markup_result() -> YarnMarkupParseResultReturns YarnMarkupParseResult
#get_plain_text()
Returns the option text with markup tags stripped.
func get_plain_text() -> StringReturns String
#set_markup_result(YarnMarkupParseResult)
#try_get_attribute(String)
func try_get_attribute(attr_name: String) -> YarnMarkupAttributeParameters
attr_nameString
Returns YarnMarkupAttribute
Generated from Yarn Spinner for Godot GDScript 3.3.