LogoLogo
HomepageDiscordItchPatreon
Yarn Spinner 2.4
Yarn Spinner 2.4
  • ⭐Start Here
  • 🧶Yarn Spinner Components
  • Beginner's Guide
    • Welcome
    • ➿Syntax Basics
    • 📖Writing Narratives
    • 🎮Using a Game Engine
      • Yarn Spinner for Unity
      • Yarn Spinner for Godot
      • Yarn Spinner for Rust
  • Writing Dialogue in Yarn
    • ⌨️Editing with VS Code
      • Installing the Extension
      • Writing Yarn in VS Code
      • Previewing Your Dialogue
      • Writing Together
    • ✍️Writing in Yarn
      • Nodes, Lines, and Options
      • Variables
      • Flow Control
      • Markup
      • Commands
      • Functions
      • Tags and Metadata
    • 🪄Upgrading Yarn Scripts
  • Yarn Spinner for Unity
    • Overview
    • 📦Installation for Unity
    • ⚡Unity Quick Start
    • 📥Importing Yarn Files
      • Yarn Projects
      • Yarn Scripts
    • 🧱Components
      • Dialogue Runner
      • Dialogue Views
        • Line View
        • Options List View
        • Option View
        • Creating Custom Dialogue Views
        • Dialogue Advance Input
      • Variable Storage
        • In-Memory Variable Storage
        • Custom Variable Storage Components
      • Line Provider
        • Unity Localised Line Provider
        • Text Line Provider
        • Audio Line Provider
    • 🤖Commands and Functions
    • 🗺️Localisations and Assets
      • In-built Localisation
      • Unity Localisation
    • 💡Frequently Asked Questions / "How Do I...?"
    • 🎁Unity Samples
      • Intro
  • Yarn Spinner for Unreal
    • 🧑🏼‍🏫Unreal Beta Quickstart
  • Yarn Spinner for Rust
    • Overview
    • ⚡Bevy Quick Start
    • 📥Compiling Yarn Files into Yarn Projects
    • 🧱Components
      • Dialogue Runner and a High Level Overview
      • Dialogue Views
      • Variable Storage
      • Assets
    • 🤖Custom Commands and Functions
      • Commands
      • Functions
    • 🗺️Localisations
    • 💡Frequently Asked Questions / "How Do I...?"
    • 🎁Bevy Samples
  • Yarn Spinner for Godot
    • Overview
    • 📦Installation for Godot
    • 📥Importing Yarn Files
      • Yarn Projects
      • Yarn Scripts
    • 🧱Components
      • Dialogue Runner
      • Dialogue Views
        • Line View
        • Options List View
        • Option View
        • Creating Custom Dialogue Views
      • Variable Storage
        • In-Memory Variable Storage
        • Custom Variable Storage Components
      • Line Provider
        • Text Line Provider
      • Markup Palette
    • 🤖Commands and Functions
    • 🗺️Localization
    • Advanced Guides
      • Implementing Custom Variable Storage
  • Unity Tutorial Projects
    • 🛠️Choose-Your-Path Game
    • 🛠️Choose-Your-Path Game with Visuals
    • 🛠️NPC Dialogue Game
  • Unity Add-Ons
    • ⭐About Add-Ons
    • Dialogue Wheel
      • Installing Dialogue Wheel
      • Using Six-Segment Wheel
      • Using Auto-Layout Wheel
      • Dialogue Wheel Examples
    • Speech Bubbles
      • Installing Speech Bubbles
      • Using Speech Bubbles
      • Speech Bubble Examples
  • Advanced Guides
    • Building a Custom Dialogue Runner
    • Yarn Variables and Custom Variable Storage
  • About
    • Crediting Yarn Spinner
    • The Yarn Spinner Team
    • GitHub Repositories
    • Community Projects
  • API Documentation
    • C#
      • Yarn Namespace
        • BuiltinTypes
          • Any
          • Boolean
          • Number
          • String
          • TypeMappings
        • Command
          • Text
        • CommandHandler
        • Dialogue
          • DefaultStartNodeName
          • Dialogue(Yarn.IVariableStorage)
          • AddProgram(Program)
          • Continue()
          • ExpandSubstitutions(string,IList<string>)
          • GetStringIDForNode(string)
          • GetTagsForNode(string)
          • NodeExists(string)
          • ParseMarkup(string)
          • SetNode(string)
          • SetProgram(Program)
          • SetSelectedOption(int)
          • Stop()
          • UnloadAll()
          • CommandHandler
          • CurrentNode
          • DialogueCompleteHandler
          • IsActive
          • LanguageCode
          • Library
          • LineHandler
          • LogDebugMessage
          • LogErrorMessage
          • NodeCompleteHandler
          • NodeNames
          • NodeStartHandler
          • OptionsHandler
          • PrepareForLinesHandler
          • VariableStorage
        • DialogueCompleteHandler
        • DialogueException
        • FunctionType
          • Description
          • Methods
          • Name
          • Parameters
          • Parent
          • ReturnType
        • Header
          • KeyFieldNumber
          • ValueFieldNumber
          • Header()
          • Header(Header)
          • CalculateSize()
          • Clone()
          • Equals(object)
          • Equals(Header)
          • GetHashCode()
          • MergeFrom(pb::CodedInputStream)
          • MergeFrom(Header)
          • ToString()
          • WriteTo(pb::CodedOutputStream)
          • Descriptor
          • Key
          • Parser
          • Value
        • IType
          • Description
          • Methods
          • Name
          • Parent
        • IVariableStorage
          • Clear()
          • SetValue(string,bool)
          • SetValue(string,float)
          • SetValue(string,string)
          • TryGetValue(string,T)
        • Library
          • DeregisterFunction(string)
          • FunctionExists(string)
          • GenerateUniqueVisitedVariableForNode(string)
          • GetFunction(string)
          • ImportLibrary(Library)
          • RegisterFunction(string,Delegate)
          • RegisterFunction(string,Func<TResult>)
          • RegisterFunction(string,Func<T1, TResult>)
          • RegisterFunction(string,Func<T1, T2, TResult>)
          • RegisterFunction(string,Func<T1, T2, T3, TResult>)
          • RegisterFunction(string,Func<T1, T2, T3, T4, TResult>)
          • RegisterFunction(string,Func<T1, T2, T3, T4, T5, TResult>)
        • Line
          • ID
          • Substitutions
        • LineHandler
        • Logger
        • MemoryVariableStore
          • Clear()
          • SetValue(string,bool)
          • SetValue(string,float)
          • SetValue(string,string)
          • TryGetValue(string,T)
        • Node
          • ToString()
          • Headers
          • Instructions
          • Labels
          • Name
          • SourceTextStringID
          • Tags
        • NodeCompleteHandler
        • NodeStartHandler
        • OptionSet
          • Options
          • Option
            • DestinationNode
            • ID
            • IsAvailable
            • Line
        • OptionsHandler
        • PrepareForLinesHandler
        • Program
          • Combine(Program[])
          • LineIDsForNode(string)
          • ToString()
          • InitialValues
          • Name
          • Nodes
      • Yarn.Markup Namespace
        • MarkupAttribute
          • ToString()
          • Length
          • Name
          • Position
          • Properties
        • MarkupParseException
        • MarkupParseResult
          • Attributes
          • Text
          • DeleteRange(MarkupAttribute)
          • TextForAttribute(MarkupAttribute)
          • TryGetAttributeWithName(string,MarkupAttribute)
        • MarkupProperty
          • Name
          • Value
        • MarkupValue
          • ToString()
          • BoolValue
          • FloatValue
          • IntegerValue
          • StringValue
          • Type
        • MarkupValueType
          • Bool
          • Float
          • Integer
          • String
      • Yarn.Compiler Namespace
        • BasicBlock
          • AddDestination(string,Condition)
          • AddDestination(BasicBlock,Condition)
          • Ancestors
          • Descendants
          • DescendantsWithPlayerVisibleContent
          • Destinations
          • FirstInstructionIndex
          • Instructions
          • LabelName
          • Name
          • NodeName
          • PlayerVisibleContent
          • CommandElement
            • CommandText
          • Condition
            • DirectJump
            • ExpressionIsFalse
            • ExpressionIsTrue
            • Fallthrough
            • Option
          • Destination
            • Block
            • Condition
            • NodeName
            • Type
            • DestinationType
              • Block
              • Node
          • LineElement
            • LineID
          • OptionsElement
            • Options
            • Option
              • Destination
              • LineID
          • PlayerVisibleContentElement
        • CompilationJob
          • CompilationType
          • Files
          • Library
          • VariableDeclarations
          • CreateFromFiles(IEnumerable<string>,Library)
          • CreateFromFiles(string[])
          • CreateFromString(string,string,Library)
          • File
            • FileName
            • Source
          • Type
            • DeclarationsOnly
            • FullCompilation
            • StringsOnly
        • CompilationResult
          • ContainsImplicitStringTags
          • DebugInfo
          • Declarations
          • Diagnostics
          • FileTags
          • Program
          • StringTable
        • Compiler
          • Compile(CompilationJob)
          • FlattenParseTree(IParseTree)
          • GetDocumentComments(CommonTokenStream,ParserRuleContext,bool)
          • GetLineIDForNodeName(string)
        • DebugInfo
          • GetLineInfo(int)
          • LineInfo
            • CharacterNumber
            • FileName
            • LineNumber
            • NodeName
        • Declaration
          • ExternalDeclaration
          • CreateVariable(string,Yarn.IType,IConvertible,string)
          • Equals(object)
          • GetHashCode()
          • ToString()
          • DefaultValue
          • Description
          • IsImplicit
          • IsVariable
          • Name
          • Range
          • SourceFileLine
          • SourceFileName
          • SourceNodeName
          • Type
        • DeclarationBuilder
          • WithDefaultValue(System.IConvertible)
          • WithDescription(string)
          • WithImplicit(bool)
          • WithName(string)
          • WithRange(Yarn.Compiler.Range)
          • WithSourceFileName(string)
          • WithSourceNodeName(string)
          • WithType(IType)
          • Declaration
        • DeferredTypeDiagnostic
          • CreateDeferredTypeDiagnostic(string,Diagnostic)
          • diagnostic
          • Name
        • Diagnostic
          • Diagnostic(string,ParserRuleContext,string,DiagnosticSeverity)
          • Diagnostic(string,string,DiagnosticSeverity)
          • Diagnostic(string,DiagnosticSeverity)
          • Diagnostic(string,Range,string,DiagnosticSeverity)
          • Equals(object)
          • GetHashCode()
          • ToString()
          • Column
          • Context
          • FileName
          • Line
          • Message
          • Range
          • Severity
          • DiagnosticSeverity
            • Error
            • Info
            • Warning
        • FileParseResult
          • FileParseResult(string,IParseTree,CommonTokenStream)
          • Equals(object)
          • GetHashCode()
          • Name
          • Tokens
          • Tree
        • FunctionTypeBuilder
          • WithParameter(IType)
          • WithReturnType(IType)
          • FunctionType
        • IndentAwareLexer
          • IndentAwareLexer(ICharStream,TextWriter,TextWriter)
          • NextToken()
          • Warnings
          • Warning
            • Message
            • Token
        • InstructionCollectionExtensions
          • GetBasicBlocks(Node)
        • Position
          • Equals(object)
          • GetHashCode()
          • Character
          • Line
        • Project
          • CurrentProjectFileVersion
          • GetJson()
          • IsMatchingPath(string)
          • LoadFromFile(string)
          • SaveToFile(string)
          • BaseLanguage
          • CompilerOptions
          • Definitions
          • DefinitionsPath
          • ExcludeFilePatterns
          • FileVersion
          • Localisation
          • Path
          • SourceFilePatterns
          • SourceFiles
          • LocalizationInfo
            • Assets
            • Strings
        • Range
          • Range()
          • Range(int,int,int,int)
          • Equals(object)
          • GetHashCode()
          • End
          • Start
        • StringInfo
          • fileName
          • isImplicitTag
          • lineNumber
          • metadata
          • nodeName
          • text
          • ToString()
        • Utility
          • AddTagsToLines(string,ICollection<string>)
          • DetermineNodeConnections(string[])
          • ExtractStringBlocks(IEnumerable<Node>)
          • GenerateYarnFileWithDeclarations(IEnumerable<Yarn.Compiler.Declaration>,string,IEnumerable<string>,IDictionary<string, string>)
          • ParseSource(string)
          • TagLines(string,ICollection<string>)
      • Yarn.Compiler.Upgrader Namespace
        • LanguageUpgrader
          • Upgrade(UpgradeJob)
        • OrderedSet
          • OrderedSet()
          • OrderedSet(IEqualityComparer<T>)
          • Add(T)
          • Add(IEnumerable<T>)
          • Clear()
          • Contains(T)
          • CopyTo(T[],int)
          • GetEnumerator()
          • Remove(T)
          • Count
          • IsReadOnly
        • TextReplacement
          • Comment
          • OriginalText
          • ReplacementText
          • Start
          • StartLine
          • OriginalLength
          • ReplacementLength
        • UpgradeJob
          • Files
          • UpgradeType
          • UpgradeJob(UpgradeType,IEnumerable<CompilationJob.File>)
        • UpgradeResult
          • Files
          • Diagnostics
          • OutputFile
            • Diagnostics
            • IsNewFile
            • OriginalSource
            • Path
            • Replacements
            • UpgradedSource
        • UpgradeType
          • Version1to2
      • Yarn.Unity Namespace
        • Actions
          • Actions(DialogueRunner,Library)
          • AddCommandHandler(string,Action)
          • AddCommandHandler(string,Delegate)
          • AddCommandHandler(string,Func<IEnumerator>)
          • AddCommandHandler(string,Func<Coroutine>)
          • AddCommandHandler(string,MethodInfo)
          • AddCommandHandler(string,Action<T1>)
          • AddCommandHandler(string,Func<T1, IEnumerator>)
          • AddCommandHandler(string,Func<T1, Coroutine>)
          • AddCommandHandler(string,Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IEnumerator>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Coroutine>)
          • AddCommandHandler(string,Action<T1, T2>)
          • AddCommandHandler(string,Func<T1, T2, IEnumerator>)
          • AddCommandHandler(string,Func<T1, T2, Coroutine>)
          • AddCommandHandler(string,Action<T1, T2, T3>)
          • AddCommandHandler(string,Func<T1, T2, T3, IEnumerator>)
          • AddCommandHandler(string,Func<T1, T2, T3, Coroutine>)
          • AddCommandHandler(string,Action<T1, T2, T3, T4>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, IEnumerator>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, Coroutine>)
          • AddCommandHandler(string,Action<T1, T2, T3, T4, T5>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, IEnumerator>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, Coroutine>)
          • AddCommandHandler(string,Action<T1, T2, T3, T4, T5, T6>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, IEnumerator>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, Coroutine>)
          • AddCommandHandler(string,Action<T1, T2, T3, T4, T5, T6, T7>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, T7, IEnumerator>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, T7, Coroutine>)
          • AddCommandHandler(string,Action<T1, T2, T3, T4, T5, T6, T7, T8>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, T7, T8, IEnumerator>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, T7, T8, Coroutine>)
          • AddCommandHandler(string,Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IEnumerator>)
          • AddCommandHandler(string,Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, Coroutine>)
          • AddFunction(string,Delegate)
          • AddFunction(string,Func<TResult>)
          • AddFunction(string,Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>)
          • AddFunction(string,Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>)
          • AddFunction(string,Func<T1, TResult>)
          • AddFunction(string,Func<T1, T2, TResult>)
          • AddFunction(string,Func<T1, T2, T3, TResult>)
          • AddFunction(string,Func<T1, T2, T3, T4, TResult>)
          • AddFunction(string,Func<T1, T2, T3, T4, T5, TResult>)
          • AddFunction(string,Func<T1, T2, T3, T4, T5, T6, TResult>)
          • AddFunction(string,Func<T1, T2, T3, T4, T5, T6, T7, TResult>)
          • AddFunction(string,Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>)
          • AddRegistrationMethod(Action<IActionRegistration>)
          • GetLibrary()
          • RegisterActions()
          • RemoveCommandHandler(string)
          • RemoveFunction(string)
          • SetupForProject(YarnProject)
          • Commands
          • DialogueRunner
          • Library
        • AudioLineProvider
          • audioLanguage
          • textLanguageCode
          • GetLocalizedLine(Line)
          • PrepareForLines(IEnumerable<string>)
          • LinesAvailable
          • LocaleCode
        • CharacterColorView
          • RunLine(LocalizedLine,Action)
          • CharacterColorData
            • characterName
            • displayColor
        • Culture
          • DisplayName
          • IsNeutralCulture
          • Name
          • NativeName
          • Culture(System.Globalization.CultureInfo)
        • Cultures
          • GetCulture(string)
          • GetCultures()
          • HasCulture(string)
          • CurrentNeutralCulture
        • DialogueAdvanceInput
          • continueAction
          • continueActionKeyCode
          • continueActionReference
          • continueActionType
          • dialogueView
          • enableActionOnStart
          • Action
          • ContinueActionType
            • InputSystemAction
            • InputSystemActionFromAsset
            • KeyCode
            • None
        • DialogueCharacterNameView
          • onDialogueStarted
          • onNameNotPresent
          • onNameUpdate
          • DialogueStarted()
          • RunLine(LocalizedLine,Action)
        • DialogueOption
          • DialogueOptionID
          • IsAvailable
          • Line
          • TextID
        • DialogueReference
          • nodeName
          • project
          • DialogueReference()
          • DialogueReference(YarnProject,string)
          • M:Yarn.Unity.DialogueReference.op_Implicit(Yarn.Unity.DialogueReference)~System.String
          • IsValid
        • DialogueRunner
          • dialogueViews
          • lineProvider
          • onCommand
          • onDialogueComplete
          • onDialogueStart
          • onNodeComplete
          • onNodeStart
          • runSelectedOptionAsLine
          • startAutomatically
          • startNode
          • verboseLogging
          • yarnProject
          • AddCommandHandler(string,System.Action)
          • AddCommandHandler(string,Delegate)
          • AddCommandHandler(string,System.Func<IEnumerator>)
          • AddCommandHandler(string,System.Func<Coroutine>)
          • AddCommandHandler(string,MethodInfo)
          • AddCommandHandler(string,System.Action<T1>)
          • AddCommandHandler(string,System.Func<T1, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2>)
          • AddCommandHandler(string,System.Func<T1, T2, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6, T7>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6, T7, T8>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, Coroutine>)
          • AddFunction(string,Delegate)
          • AddFunction(string,System.Func<TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>)
          • AddFunction(string,System.Func<T1, TResult>)
          • AddFunction(string,System.Func<T1, T2, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, T7, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>)
          • Clear()
          • GetTagsForNode(String)
          • LoadStateFromPersistentStorage(string)
          • LoadStateFromPlayerPrefs(string)
          • NodeExists(string)
          • OnViewRequestedInterrupt()
          • RemoveCommandHandler(string)
          • RemoveFunction(string)
          • SaveStateToPersistentStorage(string)
          • SaveStateToPlayerPrefs(string)
          • SetDialogueViews(DialogueViewBase[])
          • SetInitialVariables(bool)
          • SetProject(YarnProject)
          • SplitCommandText(string)
          • StartDialogue(string)
          • Stop()
          • CurrentNodeName
          • Dialogue
          • IsDialogueRunning
          • VariableStorage
          • StringUnityEvent
        • DialogueViewBase
          • requestInterrupt
          • DialogueComplete()
          • DialogueStarted()
          • DismissLine(Action)
          • InterruptLine(LocalizedLine,Action)
          • RunLine(LocalizedLine,Action)
          • RunOptions(DialogueOption[],Action<int>)
          • UserRequestedViewAdvancement()
        • Effects
          • FadeAlpha(CanvasGroup,float,float,float,CoroutineInterruptToken)
          • PausableTypewriter(TextMeshProUGUI,float,Action,Action,Action,Stack<(int position, float duration)>,CoroutineInterruptToken)
          • Typewriter(TextMeshProUGUI,float,Action,CoroutineInterruptToken)
          • CoroutineInterruptToken
            • Complete()
            • Interrupt()
            • Start()
            • CanInterrupt
            • WasInterrupted
        • IActionRegistration
          • AddCommandHandler(string,System.Action)
          • AddCommandHandler(string,Delegate)
          • AddCommandHandler(string,System.Func<IEnumerator>)
          • AddCommandHandler(string,System.Func<Coroutine>)
          • AddCommandHandler(string,MethodInfo)
          • AddCommandHandler(string,System.Action<T1>)
          • AddCommandHandler(string,System.Func<T1, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2>)
          • AddCommandHandler(string,System.Func<T1, T2, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6, T7>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6, T7, T8>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, Coroutine>)
          • AddCommandHandler(string,System.Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IEnumerator>)
          • AddCommandHandler(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, Coroutine>)
          • AddFunction(string,Delegate)
          • AddFunction(string,System.Func<TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>)
          • AddFunction(string,System.Func<T1, TResult>)
          • AddFunction(string,System.Func<T1, T2, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, T7, TResult>)
          • AddFunction(string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>)
          • RemoveCommandHandler(string)
          • RemoveFunction(string)
        • ICommand
          • Name
        • InMemoryVariableStorage
          • showDebug
          • Clear()
          • Contains(string)
          • GetAllVariables()
          • GetDebugList()
          • SetAllVariables(Dictionary<string, float>,Dictionary<string, string>,Dictionary<string, bool>,bool)
          • SetValue(string,bool)
          • SetValue(string,float)
          • SetValue(string,string)
          • TryGetValue(string,T)
        • LanguageAttribute
        • LineMetadata
          • GetLineIDs()
          • GetMetadata(string)
        • LineProviderBehaviour
          • GetLocalizedLine(Yarn.Line)
          • PrepareForLines(IEnumerable<string>)
          • Start()
          • LinesAvailable
          • LocaleCode
          • YarnProject
        • LineView
          • DialogueComplete()
          • DismissLine(Action)
          • GetPauseDurationsInsideLine(Markup.MarkupParseResult)
          • InterruptLine(LocalizedLine,Action)
          • OnContinueClicked()
          • PaletteMarkedUpText(Markup.MarkupParseResult,MarkupPalette)
          • RunLine(LocalizedLine,Action)
          • UserRequestedViewAdvancement()
        • Localization
          • AddLocalizedObject(string,T)
          • AddLocalizedObjects(IEnumerable<KeyValuePair<string, T>>)
          • AddLocalizedString(string,string)
          • AddLocalizedStrings(IEnumerable<KeyValuePair<string, string>>)
          • AddLocalizedStrings(IEnumerable<StringTableEntry>)
          • Clear()
          • ContainsLocalizedObject(string)
          • ContainsLocalizedString(string)
          • GetLineIDs()
          • GetLocalizedObject(string)
          • GetLocalizedString(string)
          • SetLocalizedObject(string,T)
          • ContainsLocalizedAssets
          • LocaleCode
          • UsesAddressableAssets
        • LocalizationType
          • Unity
          • YarnInternal
        • LocalizedLine
          • Asset
          • Metadata
          • RawText
          • Substitutions
          • TextID
          • CharacterName
          • Text
          • TextWithoutCharacterName
        • MarkupPalette
          • ColourMarkers
          • ColorForMarker(string,Color)
          • ColorMarker
            • Color
            • Marker
        • OptionsListView
          • DialogueComplete()
          • OnEnable()
          • Reset()
          • RunLine(LocalizedLine,Action)
          • RunOptions(DialogueOption[],Action<int>)
          • Start()
        • OptionView
          • OnOptionSelected
          • palette
          • InvokeOptionSelected()
          • OnPointerClick(PointerEventData)
          • OnPointerEnter(PointerEventData)
          • OnSubmit(BaseEventData)
          • Option
        • SampleRenderDetector
        • SerializedDictionary
          • Add(TKey,TValue)
          • Add(KeyValuePair<TKey, TValue>)
          • Clear()
          • Contains(KeyValuePair<TKey, TValue>)
          • ContainsKey(TKey)
          • CopyTo(KeyValuePair<TKey, TValue>[],int)
          • GetEnumerator()
          • Remove(TKey)
          • Remove(KeyValuePair<TKey, TValue>)
          • TryGetValue(TKey,TValue)
          • Count
          • IsReadOnly
          • this[TKey key]
          • Keys
          • Values
        • StringTableEntry
          • Comment
          • File
          • ID
          • Language
          • LineNumber
          • Lock
          • Node
          • Text
          • StringTableEntry(StringTableEntry)
          • CreateCSV(IEnumerable<StringTableEntry>)
          • Equals(object)
          • GetHashCode()
          • ParseFromCSV(string)
          • ToString()
        • TextLineProvider
          • textLanguageCode
          • GetLocalizedLine(Yarn.Line)
          • PrepareForLines(IEnumerable<string>)
          • LinesAvailable
          • LocaleCode
        • VariableStorageBehaviour
          • Clear()
          • Contains(string)
          • GetAllVariables()
          • SetAllVariables(FloatDictionary,StringDictionary,BoolDictionary,bool)
          • SetValue(string,bool)
          • SetValue(string,float)
          • SetValue(string,string)
          • TryGetValue(string,T)
        • VoiceOverView
          • audioSource
          • fadeOutTimeOnLineFinish
          • waitTimeAfterLineComplete
          • waitTimeBeforeLineStart
          • DialogueComplete()
          • DismissLine(Action)
          • InterruptLine(LocalizedLine,Action)
          • RunLine(LocalizedLine,Action)
          • UserRequestedViewAdvancement()
        • YarnActionAttribute
          • Name
        • YarnCommandAttribute
          • Injector
        • YarnFunctionAttribute
        • YarnNodeAttribute
          • yarnProjectAttribute
        • YarnParameterAttribute
          • Injector
        • YarnProject
          • baseLocalization
          • compiledYarnProgram
          • lineMetadata
          • localizations
          • localizationType
          • searchAssembliesForActions
          • GetHeaders(string)
          • GetLineIDsForNodes(IEnumerable<string>)
          • GetLocalization(string)
          • InitialValues
          • NodeNames
          • Program
        • YarnStateInjectorAttribute
          • Injector
      • Yarn.Unity.UnityLocalization Namespace
        • UnityLocalisedLineProvider
          • GetLocalizedLine(Yarn.Line)
          • PrepareForLines(IEnumerable<string>)
          • Start()
          • LinesAvailable
          • LocaleCode
    • Rust
      • bevy_yarnspinner
      • bevy_yarnspinner_example_dialogue_view
      • yarnspinner
Powered by GitBook

Community

  • Discord
  • Bluesky
  • Mastodon
  • Itch

Yarn Spinner® and Secret Lab® are trade marks of Secret Lab Pty. Ltd., and are used by Yarn Spinner Pty. Ltd. under license.

On this page
  • Dialog Flow
  • Variable Storage
  • Functions and Commands
  • Text and Assets
  • Builder API

Was this helpful?

Edit on GitHub
Export as PDF
  1. Yarn Spinner for Rust
  2. Components

Dialogue Runner and a High Level Overview

PreviousComponentsNextDialogue Views

Last updated 1 year ago

Was this helpful?

The main way to actually manipulate the state of your dialog is through a DialogueRunner. You create it from a YarnProject (see ) with either YarnProject::create_dialogue_runner() or YarnProject::build_dialogue_runner(). The first uses default configurations which should be alright for many use-cases, while the latter allows you to add or change functionality.

Dialog Flow

The actual navigation through a dialog is handled by a , which is responsible for back-and-forth interaction with the player. As such, most of the methods provided by a DialogueRunner are to be called by such a view. The one you will want to call yourself, as seen in the , is DialogueRunner::start_node, which will tell the DialogueRunner to start running from the provided .

Variable Storage

need to be stored in some place. By default, they are kept in memory through the InMemoryVariableStorage. This means that when you quit and reopen the game, all variables used in Yarn files will be empty again. Of course, this is suboptimal when you want to allow the player saving and loading their game state. To accomplish this, you can go one of two routes:

  • Manipulate the variables in the variable store. Read then when saving and write them when loading. You can access the variable storage through DialogueRunner::variable_storage().

  • Directory use a variable storage that stores its variables in a persistent way, such as a database or a file. You can change the underlying variable storage through the builder API discussed later in this chapter.

For information on how to create your own variable storage, see the chapter

Functions and Commands

Yarn files can contain user-defined functions and commands. These can be accessed with DialogueRunner::library() and DialogueRunner::commands(). For more information, see the chapters and .

Text and Assets

We make a distinction between text, which are the written words organized into lines contained in Yarn files or in , and assets, which are supplemental data associated with a line. Assets are referenced over a Bevy Handle and can be used for things such as voiceover sound files or images that might need translation.

Of note is that using assets requires using , or at least thinking about it. As a consequence, language settings are split between text and assets. After all, a player might want to hear lines delivered in the original recorded language but read the text translated into their own language.

Text is provided by a TextProvider. While it can be overwritten, the default StringsFileTextProvider will be a good choice for nearly all users. The only reason you might have to create an own TextProvider is if you want a very custom localization strategy, such as translating text automatically through AI.

Text and asset providers can be set through the builder API and accessed later with DialogueRunner::text_provider() and DialogueRunner::asset_providers(). If you know the exact type T of AssetProvider you want, you can call DialogueRunner::asset_provider::<T>() instead.

Builder API

As mentioned in the beginning of this chapter, a DialogueRunner can be modified or extended on creation by using YarnProject::build_dialogue_runner(). In fact, YarnProject::create_dialogue_runner() is nothing but a shorthand for YarnProject::build_dialogue_runner().build().

You can use the builder API to inject your own implementations of traits used for the features presented in this chapter. DialogueRunnerBuilder::with_variable_storage changes the underlying VariableStorage and DialogueRunnerBuilder::with_text_provider the TextProvider. DialogueRunnerBuilder::add_asset_provider adds an AssetProvider to the set of asset providers called for each line presented to the player.

You can read more about how current language can be set for a DialogueRunner in the chapter.

Assets are provided by AssetProviders. In contrast to the TextProvider, you might very well create your own AssetProvider. For your convenience, Yarn Spinner already ships with an AudioAssetProvider that you can use for voice lines and a FileExtensionAssetProvider that can load any asset based on naming conventions and file extensions. See the chapter .

🧱
Compiling Yarn Files
Dialogue View
Quick Start
node
Variables
Variable Storage
Custom Functions
Custom Commands
localization files
localization
localization
Assets