Yarn Spinner 3 is now available!
Buy Now
LogoLogo
HomepageDiscordItchPatreonAsset Store
Yarn Spinner 3.0
Yarn Spinner 3.0
  • ⭐Start Here
    • Yarn Spinner 3
  • Beginner's Guide
  • About Yarn Spinner
  • Crediting Yarn Spinner
  • FAQ
  • Writing Yarn Scripts
    • ⭐First Steps with Scripting
    • Yarn Spinner Editor
      • Writing Yarn in VS Code
      • Previewing Your Dialogue
      • Writing Together
    • Scripting Fundamentals
      • Nodes and Lines
      • Options
      • Jump Command
      • Detour Command
      • Variables
      • Flow Control
      • Once
      • Smart Variables
      • Enums
      • Commands
      • Functions
      • Line Groups
    • Advanced Scripting
      • Node Groups
      • Storylets and Saliency Primer
      • Saliency
      • Tags and Metadata
      • Markup
      • Shadow Lines
  • Yarn Spinner for Unity
    • ⭐First Steps with Unity
    • Installation for Unity
      • Unity Quick Start
    • Yarn Spinner in Unity Scenes
      • Unity Projects + Yarn Spinner
    • Your First Yarn Spinner Game
    • Commands and Functions
    • Localisation and Assets
      • In-built Localisation
      • Unity Localisation
    • Samples
      • Welcome
      • Feature Tour
      • Theming Default Presenters
      • Create a Phone Chat View
      • Make Options Timeout
      • Voice Over and Localisation
      • Background Chatter
      • Inline Events
      • Replacement Markup
      • Storylets and Saliency
        • Basic Storylets and Saliency
        • Advanced Saliency
        • Custom Saliency Strategies
    • Unity Add-Ons
      • Speech Bubbles
        • Installing Speech Bubbles
        • Using Speech Bubbles
        • Speech Bubble Examples
      • Dialogue Wheel
        • Installing Dialogue Wheel
        • Using Six-Segment Wheel
        • Using Auto-Layout Wheel
        • Dialogue Wheel Examples
  • Components
    • Dialogue Runners and Systems
    • Dialogue Presenters
      • Line Presenter
      • Options Presenter
      • Line Advancer
      • Custom Dialogue Presenters
    • Variable Storage
      • In-Memory Variable Storage
      • Variable Storage
      • Custom Variable Storage Components
    • Line Provider
      • Built-in Localised Line Provider
      • Unity Localised Line Provider
    • Asynchronous Programming
  • Changelog
    • Upgrading from Yarn Spinner 2
  • Yarn Spinner for Other Engines
    • Godot
      • Overview
      • 📦Installation for Godot
      • 📥Importing Yarn Files
        • Yarn Projects
        • Yarn Scripts
      • 🧱Components
        • Dialogue Runner
        • Dialogue Presenters
          • Line Presenter
          • Options Presenter
          • 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
    • Unreal
      • 🧑🏼‍🏫Unreal Beta Quickstart
    • Bevy
      • ⚡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
  • API
    • C#
      • Yarn.Utility Namespace
        • CRC32
          • GetChecksum(byte[])
          • GetChecksum(string)
          • GetChecksumString(string)
      • Yarn Namespace
        • Command
          • Text
        • CommandHandler
        • ConstantTypeProperty
          • Description
          • Type
          • Value
        • Dialogue
          • DefaultStartNodeName
          • Dialogue(Yarn.IVariableStorage)
          • Continue()
          • GetHeaders(string)
          • GetHeaderValue(string,string)
          • GetSaliencyOptionsForNodeGroup(string)
          • GetStringIDForNode(string)
          • GetTagsForNode(string)
          • HasSalientContent(string)
          • IsNodeGroup(string)
          • NodeExists(string)
          • SetNode(string)
          • SetProgram(Program)
          • SetSelectedOption(int)
          • Stop()
          • TryGetSmartVariable<T>(string,T)
          • UnloadAll()
          • CommandHandler
          • ContentSaliencyStrategy
          • CurrentNode
          • DialogueCompleteHandler
          • IsActive
          • Library
          • LineHandler
          • LogDebugMessage
          • LogErrorMessage
          • NodeCompleteHandler
          • NodeNames
          • NodeStartHandler
          • OptionsHandler
          • PrepareForLinesHandler
          • VariableStorage
        • DialogueCompleteHandler
        • DialogueException
        • EnumBase
          • EnumBase()
          • Description
          • Name
          • Parent
        • EnumType
          • EnumType(string,string,TypeBase)
          • Description
          • EnumCases
          • Name
          • Parent
          • RawType
        • FunctionType
          • FunctionType(IType,IType[])
          • Equals(IType)
          • GetParameterAt(int)
          • ToString()
          • Description
          • Name
          • Parameters
          • Parent
          • ReturnType
          • TypeMembers
          • VariadicParameterType
        • 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
        • IMarkupParser
          • ParseMarkup(string,string)
        • ISmartVariableEvaluator
          • TryGetSmartVariable<T>(string,T)
        • IType
          • Description
          • Name
          • Parent
          • TypeMembers
        • ITypeMember
          • Type
        • IVariableAccess
          • GetVariableKind(string)
          • TryGetValue<T>(string,T?)
          • Program
          • SmartVariableEvaluator
        • IVariableStorage
          • Clear()
          • SetValue(string,bool)
          • SetValue(string,float)
          • SetValue(string,string)
        • IYarnValue
          • ConvertTo<T>()
        • Library
          • DeregisterFunction(string)
          • FunctionExists(string)
          • GenerateUniqueVisitedVariableForNode(string)
          • GetFunction(string)
          • ImportLibrary(Library)
          • RegisterFunction(string,Delegate)
          • RegisterFunction<TResult>(string,Func<TResult>)
          • RegisterFunction<T1, TResult>(string,Func<T1, TResult>)
          • RegisterFunction<T1, T2, TResult>(string,Func<T1, T2, TResult>)
          • RegisterFunction<T1, T2, T3, TResult>(string,Func<T1, T2, T3, TResult>)
          • RegisterFunction<T1, T2, T3, T4, TResult>(string,Func<T1, T2, T3, T4, TResult>)
          • RegisterFunction<T1, T2, T3, T4, T5, TResult>(string,Func<T1, T2, T3, T4, T5, TResult>)
        • Line
          • Line(string,string[])
          • ID
          • Substitutions
        • LineHandler
        • Logger
        • MemoryVariableStore
          • Clear()
          • GetVariableKind(string)
          • SetValue(string,bool)
          • SetValue(string,float)
          • SetValue(string,string)
          • TryGetValue<T>(string,T?)
          • Program
          • SmartVariableEvaluator
        • Node
          • NodeGroupHeader
          • ToString()
          • ContentSaliencyConditionComplexityScore
          • ContentSaliencyConditionVariables
          • Headers
          • Instructions
          • IsNodeGroupHub
          • Name
          • NodeGroup
          • Tags
          • TrackingVariableName
        • NodeCompleteHandler
        • NodeStartHandler
        • OptionSet
          • Options
          • Option
            • ID
            • IsAvailable
            • Line
        • OptionsHandler
        • PrepareForLinesHandler
        • Program
          • GetVariableKind(string)
          • LineIDsForNode(string)
          • ToString()
          • TryGetInitialValue<T>(string,T)
          • InitialValues
          • Name
          • Nodes
        • TypeBase
          • Equals(object)
          • Equals(TypeBase)
          • GetHashCode()
          • IsAncestorOf(TypeBase)
          • IsConvertibleTo(TypeBase)
          • ToString()
          • ConvertibleToTypes
          • Description
          • Methods
          • Name
          • Parent
          • TypeMembers
        • Types
          • Any
          • Boolean
          • Number
          • String
          • TypeMappings
        • VariableKind
          • Smart
          • Stored
          • Unknown
      • Yarn.Saliency Namespace
        • BestLeastRecentlyViewedSaliencyStrategy
          • BestLeastRecentlyViewedSaliencyStrategy(IVariableStorage)
          • ContentWasSelected(ContentSaliencyOption)
          • QueryBestContent(IEnumerable<ContentSaliencyOption>)
        • BestSaliencyStrategy
          • ContentWasSelected(ContentSaliencyOption)
          • QueryBestContent(IEnumerable<ContentSaliencyOption>)
        • ContentSaliencyContentType
          • Line
          • Node
        • ContentSaliencyOption
          • ContentSaliencyOption(string)
          • ComplexityScore
          • ContentID
          • ContentType
          • FailingConditionValueCount
          • PassingConditionValueCount
          • ViewCountKey
        • EnumerableRandomExtension
          • RandomElement<T>(IEnumerable<T>)
        • FirstSaliencyStrategy
          • ContentWasSelected(ContentSaliencyOption)
          • QueryBestContent(IEnumerable<ContentSaliencyOption>)
        • IContentSaliencyStrategy
          • ContentWasSelected(ContentSaliencyOption)
          • QueryBestContent(IEnumerable<ContentSaliencyOption>)
        • RandomBestLeastRecentlyViewedSaliencyStrategy
          • RandomBestLeastRecentlyViewedSaliencyStrategy(IVariableStorage)
          • ContentWasSelected(ContentSaliencyOption)
          • QueryBestContent(IEnumerable<ContentSaliencyOption>)
      • Yarn.Markup Namespace
        • BuiltInMarkupReplacer
          • ProcessReplacementMarker(MarkupAttribute,StringBuilder,List<MarkupAttribute>,string)
        • IAttributeMarkerProcessor
          • ProcessReplacementMarker(MarkupAttribute,System.Text.StringBuilder,List<MarkupAttribute>,string)
        • LineParser
          • CharacterAttribute
          • CharacterAttributeNameProperty
          • NoMarkupAttribute
          • ReplacementMarkerContents
          • TrimWhitespaceProperty
          • DeregisterMarkerProcessor(string)
          • Dispose()
          • ExpandSubstitutions(string,IList<string>)
          • ParseString(string,string,bool)
          • RegisterMarkerProcessor(string,IAttributeMarkerProcessor)
          • MarkupDiagnostic
            • MarkupDiagnostic(string,int)
            • Equals(object)
            • Equals(MarkupDiagnostic)
            • GetHashCode()
            • M:Yarn.Markup.LineParser.MarkupDiagnostic.op_Equality(Yarn.Markup.LineParser.MarkupDiagnostic,Yarn.Markup.LineParser.MarkupDiagnostic)
            • M:Yarn.Markup.LineParser.MarkupDiagnostic.op_Inequality(Yarn.Markup.LineParser.MarkupDiagnostic,Yarn.Markup.LineParser.MarkupDiagnostic)
            • Column
            • Message
        • MarkupAttribute
          • Shift(int)
          • ToString()
          • TryGetProperty(string,bool)
          • TryGetProperty(string,int)
          • TryGetProperty(string,float)
          • TryGetProperty(string,string?)
          • TryGetProperty(string,MarkupValue)
          • Length
          • Name
          • Position
          • Properties
        • MarkupParseException
        • MarkupParseResult
          • MarkupParseResult(string,List<MarkupAttribute>)
          • DeleteRange(MarkupAttribute)
          • TextForAttribute(MarkupAttribute)
          • TryGetAttributeWithName(string,MarkupAttribute)
          • Attributes
          • Text
        • MarkupProperty
          • Name
          • Value
        • MarkupValue
          • ToString()
          • ToString(IFormatProvider)
          • BoolValue
          • FloatValue
          • IntegerValue
          • StringValue
          • Type
        • MarkupValueType
          • Bool
          • Float
          • Integer
          • String
        • TagType
          • Close
          • CloseAll
          • Open
          • SelfClosing
      • Yarn.Compiler Namespace
        • CompilationJob
          • CompilationType
          • Declarations
          • Files
          • Library
          • CreateFromFiles(IEnumerable<string>,Library?)
          • CreateFromFiles(string[])
          • CreateFromString(string,string,Library?,int)
          • CancellationToken
          • LanguageVersion
          • TypeDeclarations
          • VariableDeclarations
          • File
            • FileName
            • Source
          • Type
            • DeclarationsOnly
            • FullCompilation
            • StringsOnly
            • TypeCheck
        • CompilationResult
          • GetDescriptionForVariable(string)
          • GetLabelsForNode(string)
          • GetStringForKey(string)
          • ContainsErrors
          • ContainsImplicitStringTags
          • DebugInfo
          • Declarations
          • Diagnostics
          • FileTags
          • Program
          • ProjectDebugInfo
          • StringTable
          • UserDefinedTypes
        • Compiler
          • Compile(CompilationJob)
          • FlattenParseTree(IParseTree)
          • GetDocumentComments(CommonTokenStream,ParserRuleContext,bool)
          • GetLineIDForNodeName(string)
        • Declaration
          • ExternalDeclaration
          • CreateVariable(string,IType,IConvertible,string?)
          • ToString()
          • DefaultValue
          • Dependencies
          • Dependents
          • Description
          • InitialValueParserContext
          • IsImplicit
          • IsInlineExpansion
          • 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
        • Diagnostic
          • Diagnostic(string,IToken,string,DiagnosticSeverity)
          • 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
        • EnumTypeBuilder
          • FromEnum<TEnum>(string?)
        • FileParseResult
          • FileParseResult(string,IParseTree,CommonTokenStream)
          • Equals(object)
          • GetHashCode()
          • Name
          • Tokens
          • Tree
        • FunctionTypeBuilder
          • FromFunctionType(System.Type)
          • WithParameter(IType)
          • WithReturnType(IType)
          • WithVariadicParameterType(IType?)
          • FunctionType
        • IndentAwareLexer
          • IndentAwareLexer(ICharStream,TextWriter,TextWriter)
          • IsInWhenClause()
          • NextToken()
          • SetInWhenClause(bool)
          • Warnings
          • LexerWarning
            • Message
            • Token
        • NodeDebugInfo
          • NodeDebugInfo(string?,string)
          • GetLineInfo(int)
          • FileName
          • IsImplicit
          • NodeName
          • Range
          • LineInfo
            • FileName
            • NodeName
            • Position
        • Position
          • Equals(object)
          • GetHashCode()
          • M:Yarn.Compiler.Position.op_GreaterThanOrEqual(Yarn.Compiler.Position,Yarn.Compiler.Position)
          • M:Yarn.Compiler.Position.op_LessThanOrEqual(Yarn.Compiler.Position,Yarn.Compiler.Position)
          • ToString()
          • Character
          • IsValid
          • Line
        • Project
          • CurrentProjectFileVersion
          • WorkspaceRootPlaceholder
          • YarnSpinnerProjectVersion2
          • YarnSpinnerProjectVersion3
          • Project()
          • Project(string,string?)
          • GetJson()
          • IsMatchingPath(string)
          • IsValidVersionNumber(int)
          • LoadFromFile(string,string?)
          • SaveToFile(string)
          • AllowLanguagePreviewFeatures
          • BaseLanguage
          • CompilerOptions
          • Definitions
          • DefinitionsFiles
          • DefinitionsPath
          • ExcludeFilePatterns
          • ExtensionData
          • FileVersion
          • Localisation
          • Path
          • SourceFilePatterns
          • SourceFiles
          • WorkspaceRootPath
          • LocalizationInfo
            • Assets
            • Strings
        • ProjectDebugInfo
          • GetNodeDebugInfo(string)
          • Nodes
        • Range
          • Range()
          • Range(int,int,int,int)
          • Equals(object)
          • GetHashCode()
          • ToString()
          • End
          • IsValid
          • Start
        • StringInfo
          • fileName
          • isImplicitTag
          • lineNumber
          • metadata
          • nodeName
          • shadowLineID
          • text
          • ToString()
        • Utility
          • AddTagsToLines(string,ICollection<string>?)
          • DetermineNodeConnections(string[])
          • ExtractStringBlocks(IEnumerable<Node>,ProjectDebugInfo)
          • GenerateYarnFileWithDeclarations(IEnumerable<Yarn.Compiler.Declaration>,string,IEnumerable<string>?,IDictionary<string, string>?)
          • GetCompiledCodeAsString(Program,Library?,CompilationResult?)
          • GetYarnValue(IConvertible)
          • ParseSource(string)
          • TagLines(string,ICollection<string>?)
          • TryGetNodeTitle(string?,YarnSpinnerParser.NodeContext,string?,string?,string?,string?)
      • Yarn.Compiler.Upgrader Namespace
        • LanguageUpgrader
          • Upgrade(UpgradeJob)
        • 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
        • ActionMarkupHandler
          • OnCharacterWillAppear(int,MarkupParseResult,CancellationToken)
          • OnLineDisplayBegin(MarkupParseResult,TMP_Text)
          • OnLineDisplayComplete()
          • OnLineWillDismiss()
          • OnPrepareForLine(MarkupParseResult,TMP_Text)
        • ActionRegistrationExtension
          • AddCommandHandler(IActionRegistration,string,System.Action)
          • AddCommandHandler(IActionRegistration,string,System.Func<IEnumerator>)
          • AddCommandHandler(IActionRegistration,string,System.Func<Coroutine>)
          • AddCommandHandler(IActionRegistration,string,System.Func<YarnTask>)
          • AddCommandHandler<T1>(IActionRegistration,string,System.Action<T1>)
          • AddCommandHandler<T1>(IActionRegistration,string,System.Func<T1, IEnumerator>)
          • AddCommandHandler<T1>(IActionRegistration,string,System.Func<T1, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1>(IActionRegistration,string,System.Func<T1, Coroutine>)
          • AddCommandHandler<T1>(IActionRegistration,string,System.Func<T1, YarnTask>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(IActionRegistration,string,System.Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IEnumerator>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Coroutine>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, YarnTask>)
          • AddCommandHandler<T1, T2>(IActionRegistration,string,System.Action<T1, T2>)
          • AddCommandHandler<T1, T2>(IActionRegistration,string,System.Func<T1, T2, IEnumerator>)
          • AddCommandHandler<T1, T2>(IActionRegistration,string,System.Func<T1, T2, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1, T2>(IActionRegistration,string,System.Func<T1, T2, Coroutine>)
          • AddCommandHandler<T1, T2>(IActionRegistration,string,System.Func<T1, T2, YarnTask>)
          • AddCommandHandler<T1, T2, T3>(IActionRegistration,string,System.Action<T1, T2, T3>)
          • AddCommandHandler<T1, T2, T3>(IActionRegistration,string,System.Func<T1, T2, T3, IEnumerator>)
          • AddCommandHandler<T1, T2, T3>(IActionRegistration,string,System.Func<T1, T2, T3, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1, T2, T3>(IActionRegistration,string,System.Func<T1, T2, T3, Coroutine>)
          • AddCommandHandler<T1, T2, T3>(IActionRegistration,string,System.Func<T1, T2, T3, YarnTask>)
          • AddCommandHandler<T1, T2, T3, T4>(IActionRegistration,string,System.Action<T1, T2, T3, T4>)
          • AddCommandHandler<T1, T2, T3, T4>(IActionRegistration,string,System.Func<T1, T2, T3, T4, IEnumerator>)
          • AddCommandHandler<T1, T2, T3, T4>(IActionRegistration,string,System.Func<T1, T2, T3, T4, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1, T2, T3, T4>(IActionRegistration,string,System.Func<T1, T2, T3, T4, Coroutine>)
          • AddCommandHandler<T1, T2, T3, T4>(IActionRegistration,string,System.Func<T1, T2, T3, T4, YarnTask>)
          • AddCommandHandler<T1, T2, T3, T4, T5>(IActionRegistration,string,System.Action<T1, T2, T3, T4, T5>)
          • AddCommandHandler<T1, T2, T3, T4, T5>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, IEnumerator>)
          • AddCommandHandler<T1, T2, T3, T4, T5>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1, T2, T3, T4, T5>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, Coroutine>)
          • AddCommandHandler<T1, T2, T3, T4, T5>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, YarnTask>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6>(IActionRegistration,string,System.Action<T1, T2, T3, T4, T5, T6>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, IEnumerator>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, Coroutine>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, YarnTask>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7>(IActionRegistration,string,System.Action<T1, T2, T3, T4, T5, T6, T7>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, IEnumerator>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, Coroutine>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, YarnTask>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8>(IActionRegistration,string,System.Action<T1, T2, T3, T4, T5, T6, T7, T8>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, IEnumerator>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, Coroutine>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, YarnTask>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9>(IActionRegistration,string,System.Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IEnumerator>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, System.Threading.Tasks.Task>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, Coroutine>)
          • AddCommandHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, YarnTask>)
          • AddFunction<TResult>(IActionRegistration,string,System.Func<TResult>)
          • AddFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>)
          • AddFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>)
          • AddFunction<T1, TResult>(IActionRegistration,string,System.Func<T1, TResult>)
          • AddFunction<T1, T2, TResult>(IActionRegistration,string,System.Func<T1, T2, TResult>)
          • AddFunction<T1, T2, T3, TResult>(IActionRegistration,string,System.Func<T1, T2, T3, TResult>)
          • AddFunction<T1, T2, T3, T4, TResult>(IActionRegistration,string,System.Func<T1, T2, T3, T4, TResult>)
          • AddFunction<T1, T2, T3, T4, T5, TResult>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, TResult>)
          • AddFunction<T1, T2, T3, T4, T5, T6, TResult>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, TResult>)
          • AddFunction<T1, T2, T3, T4, T5, T6, T7, TResult>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, TResult>)
          • AddFunction<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(IActionRegistration,string,System.Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>)
        • Actions
          • Actions(IActionRegistration,Library)
          • AddCommandHandler(string,Delegate)
          • AddCommandHandler(string,Func<object>)
          • AddCommandHandler(string,MethodInfo)
          • AddFunction(string,Delegate)
          • AddRegistrationMethod(ActionRegistrationMethod)
          • RegisterActions()
          • RegisterFunctionDeclaration(string,Type,Type[])
          • RemoveCommandHandler(string)
          • RemoveFunction(string)
          • SetupForProject(YarnProject)
          • ActionRegistrar
          • Commands
          • Library
        • BuiltinLocalisedLineProvider
          • DeregisterMarkerProcessor(string)
          • GetLocalizedLineAsync(Line,CancellationToken)
          • PrepareForLinesAsync(IEnumerable<string>,CancellationToken)
          • RegisterMarkerProcessor(string,Markup.IAttributeMarkerProcessor)
          • AssetLocaleCode
          • LocaleCode
        • Culture
          • DisplayName
          • IsNeutralCulture
          • Name
          • NativeName
          • Culture(System.Globalization.CultureInfo)
        • Cultures
          • GetCulture(string)
          • GetCultures()
          • HasCulture(string)
          • TryGetCulture(string,Culture)
          • CurrentNeutralCulture
        • DialogueOption
          • DialogueOptionID
          • IsAvailable
          • Line
          • TextID
        • DialoguePresenterBase
          • OnDialogueCompleteAsync()
          • OnDialogueStartedAsync()
          • RunLineAsync(LocalizedLine,LineCancellationToken)
          • RunOptionsAsync(DialogueOption[],CancellationToken)
        • DialogueReference
          • nodeName
          • project
          • DialogueReference()
          • DialogueReference(YarnProject,string)
          • IsValid
        • DialogueRunner
          • autoStart
          • onDialogueComplete
          • onDialogueStart
          • onNodeComplete
          • onNodeStart
          • onUnhandledCommand
          • runSelectedOptionAsLine
          • startNode
          • AddCommandHandler(string,Delegate)
          • AddCommandHandler(string,MethodInfo)
          • AddFunction(string,Delegate)
          • GetPauseDurationsInsideLine(Markup.MarkupParseResult)
          • LoadStateFromPersistentStorage(string)
          • RegisterFunctionDeclaration(string,Type,Type[])
          • RemoveCommandHandler(string)
          • RemoveFunction(string)
          • RequestHurryUpLine()
          • RequestNextLine()
          • SaveStateToPersistentStorage(string)
          • SetProject(YarnProject)
          • SplitCommandText(string)
          • StartDialogue(string)
          • Stop()
          • Dialogue
          • DialoguePresenters
          • DialogueTask
          • DialogueViews
          • IsDialogueRunning
          • IsInPlaymode
          • LineProvider
          • NoOptionSelected
          • VariableStorage
          • YarnProject
        • Effects
          • FadeAlpha(CanvasGroup,float,float,float,CancellationToken)
          • FadeAlpha(CanvasGroup,float,float,float,CoroutineInterruptToken?)
          • FadeAlphaAsync(CanvasGroup,float,float,float,CancellationToken)
          • PausableTypewriter(TextMeshProUGUI,float,Action?,Action?,Action?,Stack<(int position, float duration)>?,CoroutineInterruptToken?)
          • Typewriter(TextMeshProUGUI,float,Action,CoroutineInterruptToken?)
          • CoroutineInterruptToken
            • Complete()
            • Interrupt()
            • Start()
            • CanInterrupt
            • WasInterrupted
        • GeneratedVariableStorageExtensions
          • GetEnumValueOrDefault<T>(IGeneratedVariableStorage,string)
          • GetValueOrDefault<T>(IGeneratedVariableStorage,string)
          • SetValue<T>(IGeneratedVariableStorage,string,T)
        • IActionMarkupHandler
          • OnCharacterWillAppear(int,MarkupParseResult,CancellationToken)
          • OnLineDisplayBegin(MarkupParseResult,TMP_Text)
          • OnLineDisplayComplete()
          • OnLineWillDismiss()
          • OnPrepareForLine(MarkupParseResult,TMP_Text)
        • IActionRegistration
          • AddCommandHandler(string,Delegate)
          • AddCommandHandler(string,MethodInfo)
          • AddFunction(string,Delegate)
          • RegisterFunctionDeclaration(string,Type,Type[])
          • RemoveCommandHandler(string)
          • RemoveFunction(string)
        • IAssetProvider
          • GetAssetsOfType<T>()
          • TryGetAsset<T>(T?)
        • ICommand
          • Name
        • IGeneratedVariableStorage
        • ILineProvider
          • DeregisterMarkerProcessor(string)
          • GetLocalizedLineAsync(Line,CancellationToken)
          • PrepareForLinesAsync(IEnumerable<string>,CancellationToken)
          • RegisterMarkerProcessor(string,Yarn.Markup.IAttributeMarkerProcessor)
          • LocaleCode
          • YarnProject
        • 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<T>(string,T)
        • IYarnTask
          • Forget()
          • IsCompleted()
          • IsCompletedSuccessfully()
        • LineAdvancer
          • advanceRequestsBeforeCancellingLine
          • multiAdvanceIsCancel
          • OnCharacterWillAppear(int,MarkupParseResult,CancellationToken)
          • OnDialogueCompleteAsync()
          • OnDialogueStartedAsync()
          • OnLineDisplayBegin(MarkupParseResult,TMP_Text)
          • OnLineDisplayComplete()
          • OnLineWillDismiss()
          • OnPrepareForLine(MarkupParseResult,TMP_Text)
          • RequestDialogueCancellation()
          • RequestLineHurryUp()
          • RequestNextLine()
          • RunLineAsync(LocalizedLine,LineCancellationToken)
          • RunOptionsAsync(DialogueOption[],CancellationToken)
          • InputMode
            • InputActions
            • KeyCodes
            • LegacyInputAxes
            • None
        • LineCancellationToken
          • HurryUpToken
          • NextLineToken
          • IsHurryUpRequested
          • IsNextLineRequested
        • LineMetadata
          • LineMetadata()
          • AddMetadata(string,IEnumerable<string>)
          • GetLineIDs()
          • GetMetadata(string)
          • GetShadowLineSource(string)
        • LinePresenter
          • autoAdvance
          • autoAdvanceDelay
          • canvasGroup
          • characterNameContainer
          • characterNameText
          • fadeDownDuration
          • fadeUpDuration
          • lineText
          • showCharacterNameInLineView
          • temporalProcessors
          • typewriterEffectSpeed
          • useFadeEffect
          • useTypewriterEffect
          • OnDialogueCompleteAsync()
          • OnDialogueStartedAsync()
          • RunLineAsync(LocalizedLine,LineCancellationToken)
          • RunOptionsAsync(DialogueOption[],CancellationToken)
        • LinePresenterButtonHandler
          • OnCharacterWillAppear(int,MarkupParseResult,CancellationToken)
          • OnLineDisplayBegin(MarkupParseResult,TMP_Text)
          • OnLineDisplayComplete()
          • OnLineWillDismiss()
          • OnPrepareForLine(MarkupParseResult,TMP_Text)
        • LineProviderBehaviour
          • DeregisterMarkerProcessor(string)
          • GetLocalizedLineAsync(Line,CancellationToken)
          • PrepareForLinesAsync(IEnumerable<string>,CancellationToken)
          • RegisterMarkerProcessor(string,IAttributeMarkerProcessor)
          • Start()
          • LocaleCode
          • YarnProject
        • Localization
          • AddLocalizedString(string,string)
          • AddLocalizedStrings(IEnumerable<KeyValuePair<string, string>>)
          • AddLocalizedStrings(IEnumerable<StringTableEntry>)
          • Clear()
          • ContainsLocalizedObject<T>(string)
          • ContainsLocalizedString(string)
          • GetLineIDs()
          • GetLocalizedObjectAsync<T>(string)
          • GetLocalizedString(string)
          • UsesAddressableAssets
          • LocalizationTableEntry
            • localizedAsset
            • localizedAssetReference
            • localizedString
        • LocalizationType
          • Unity
          • YarnInternal
        • LocalizedLine
          • Asset
          • InvalidLine
          • Metadata
          • RawText
          • Substitutions
          • TextID
          • CharacterName
          • Text
          • TextWithoutCharacterName
        • MarkupPalette
          • BasicMarkers
          • CustomMarkers
          • ColorForMarker(string,Color)
          • PaletteForMarker(string,CustomMarker)
          • BasicMarker
            • Boldened
            • Color
            • CustomColor
            • Italicised
            • Marker
            • Strikedthrough
            • Underlined
          • CustomMarker
            • End
            • Marker
            • MarkerOffset
            • Start
        • OptionItem
          • completionToken
          • OnOptionSelected
          • InvokeOptionSelected()
          • OnDeselect(BaseEventData)
          • OnPointerClick(PointerEventData)
          • OnPointerEnter(PointerEventData)
          • OnSelect(BaseEventData)
          • OnSubmit(BaseEventData)
          • IsHighlighted
          • Option
        • OptionsPresenter
          • fadeDownDuration
          • fadeUpDuration
          • showUnavailableOptions
          • useFadeEffect
          • OnDialogueCompleteAsync()
          • OnDialogueStartedAsync()
          • RunLineAsync(LocalizedLine,LineCancellationToken)
          • RunOptionsAsync(DialogueOption[],CancellationToken)
        • PauseEventProcessor
          • OnCharacterWillAppear(int,MarkupParseResult,CancellationToken)
          • OnLineDisplayBegin(MarkupParseResult,TMP_Text)
          • OnLineDisplayComplete()
          • OnLineWillDismiss()
          • OnPrepareForLine(MarkupParseResult,TMP_Text)
        • RegistrationType
          • Compilation
          • Runtime
        • ReplacementMarkupHandler
          • NoDiagnostics
          • ProcessReplacementMarker(MarkupAttribute,StringBuilder,List<MarkupAttribute>,string)
        • SerializableDictionary
          • Storage<T>
            • data
        • SerializableDictionary<TKey, TValue>
          • SerializableDictionary()
          • SerializableDictionary(IDictionary<TKey, TValue>)
        • SerializableDictionary<TKey, TValue, TValueStorage>
          • SerializableDictionary()
          • SerializableDictionary(IDictionary<TKey, TValue>)
        • SerializableDictionaryBase
          • Storage
        • SerializableDictionaryBase<TKey, TValue, TValueStorage>
          • SerializableDictionaryBase()
          • SerializableDictionaryBase(IDictionary<TKey, TValue>)
          • Add(TKey,TValue)
          • Add(KeyValuePair<TKey, TValue>)
          • Add(object,object)
          • Clear()
          • Contains(KeyValuePair<TKey, TValue>)
          • Contains(object)
          • ContainsKey(TKey)
          • CopyFrom(IDictionary<TKey, TValue>)
          • CopyTo(Array,int)
          • CopyTo(KeyValuePair<TKey, TValue>[],int)
          • GetEnumerator()
          • GetObjectData(SerializationInfo,StreamingContext)
          • OnAfterDeserialize()
          • OnBeforeSerialize()
          • OnDeserialization(object)
          • Remove(TKey)
          • Remove(KeyValuePair<TKey, TValue>)
          • Remove(object)
          • TryGetValue(TKey,TValue)
          • Count
          • IsFixedSize
          • IsReadOnly
          • IsSynchronized
          • this[TKey key]
          • this[object key]
          • Keys
          • SyncRoot
          • Values
        • StringTableEntry
          • Comment
          • File
          • ID
          • Language
          • LineNumber
          • Lock
          • Node
          • Text
          • StringTableEntry(StringTableEntry)
          • CreateCSV(IEnumerable<StringTableEntry>)
          • Equals(object)
          • GetHashCode()
          • ParseFromCSV(string)
          • ToString()
        • StyleMarkerProcessor
          • lineProvider
          • ProcessReplacementMarker(MarkupAttribute,StringBuilder,List<MarkupAttribute>,string)
        • UnityEventString
        • VariableStorageBehaviour
          • AddChangeListener<T>(string,Action<T>)
          • Clear()
          • Contains(string)
          • GetAllVariables()
          • GetVariableKind(string)
          • SetAllVariables(FloatDictionary,StringDictionary,BoolDictionary,bool)
          • SetValue(string,bool)
          • SetValue(string,float)
          • SetValue(string,string)
          • TryGetValue<T>(string,T?)
          • Program
          • SmartVariableEvaluator
        • VoiceOverPresenter
          • audioSource
          • dialogueRunner
          • endLineWhenVoiceoverComplete
          • fadeOutTimeOnLineFinish
          • waitTimeAfterLineComplete
          • waitTimeBeforeLineStart
          • OnDialogueCompleteAsync()
          • OnDialogueStartedAsync()
          • RunLineAsync(LocalizedLine,LineCancellationToken)
          • RunOptionsAsync(DialogueOption[],CancellationToken)
        • YarnActionAttribute
          • Name
        • YarnCommandAttribute
        • YarnFunctionAttribute
        • YarnProject
          • baseLocalization
          • compiledYarnProgram
          • lineMetadata
          • localizations
          • localizationType
          • GetHeaders(string)
          • GetLineIDsForNodes(IEnumerable<string>)
          • GetLocalization(string)
          • InitialValues
          • NodeNames
          • Program
          • ShadowTableDictionary
          • ShadowTableEntry
            • shadowMetadata
            • sourceLineID
        • YarnTask
          • Delay(int,CancellationToken)
          • Delay(TimeSpan,CancellationToken)
          • Forget()
          • FromResult<T>(T)
          • GetAwaiter()
          • IsCompleted()
          • IsCompletedSuccessfully()
          • SuppressCancellationThrow()
          • ToCoroutine(Func<YarnTask>)
          • WaitForAsyncOperation(AsyncOperationHandle,CancellationToken)
          • WaitForAsyncOperation<T>(AsyncOperationHandle<T>,CancellationToken)
          • WaitUntil(System.Func<bool>,System.Threading.CancellationToken)
          • WaitUntilCanceled(System.Threading.CancellationToken)
          • WhenAll(IEnumerable<YarnTask>)
          • WhenAll(YarnTask[])
          • WhenAll<T>(IEnumerable<YarnTask<T>>)
          • WhenAll<T>(YarnTask<T>[])
          • Yield()
          • CompletedTask
        • YarnTask<T>
          • Forget()
          • FromResult(T)
          • GetAwaiter()
          • IsCompleted()
          • IsCompletedSuccessfully()
        • YarnTaskCompletionSource
          • TrySetCanceled()
          • TrySetException(System.Exception)
          • TrySetResult()
          • Task
        • YarnTaskCompletionSource<T>
          • TrySetCanceled()
          • TrySetException(System.Exception)
          • TrySetResult(T)
          • Task
        • YarnTaskExtensions
          • WaitForCoroutine(MonoBehaviour,IEnumerator)
          • WaitForCoroutine(MonoBehaviour,Coroutine)
      • Yarn.Unity.Legacy Namespace
        • DialogueAdvanceInput
          • continueAction
          • continueActionButtonName
          • continueActionKeyCode
          • continueActionOnButtonRelease
          • continueActionReference
          • continueActionType
          • dialogueView
          • enableActionOnStart
          • Action
          • ContinueActionType
            • InputSystemAction
            • InputSystemActionFromAsset
            • KeyCode
            • None
            • VirtualButton
          • ContinueButtonActionType
            • Down
            • Up
        • DialogueViewBase
          • requestInterrupt
          • DialogueComplete()
          • DialogueStarted()
          • DismissLine(Action)
          • InterruptLine(LocalizedLine,Action)
          • OnDialogueCompleteAsync()
          • OnDialogueStartedAsync()
          • RunLine(LocalizedLine,Action)
          • RunLineAsync(LocalizedLine,LineCancellationToken)
          • RunOptions(DialogueOption[],Action<int>)
          • RunOptionsAsync(DialogueOption[],CancellationToken)
          • UserRequestedViewAdvancement()
        • LineView
          • autoAdvance
          • canvasGroup
          • characterNameContainer
          • characterNameText
          • continueButton
          • fadeInTime
          • fadeOutTime
          • holdTime
          • lineText
          • onCharacterTyped
          • onPauseEnded
          • onPauseStarted
          • palette
          • showCharacterNameInLineView
          • typewriterEffectSpeed
          • useFadeEffect
          • useTypewriterEffect
          • AddLineBreaks(Markup.MarkupParseResult)
          • DialogueComplete()
          • DismissLine(Action)
          • InterruptLine(LocalizedLine,Action)
          • OnContinueClicked()
          • PaletteMarkedUpText(Markup.MarkupParseResult,MarkupPalette,bool)
          • RunLine(LocalizedLine,Action)
          • UserRequestedViewAdvancement()
        • OptionsListView
          • DialogueComplete()
          • OnEnable()
          • Reset()
          • RunLine(LocalizedLine,Action)
          • RunOptions(DialogueOption[],Action<int>)
          • Start()
        • OptionView
          • OnOptionSelected
          • palette
          • InvokeOptionSelected()
          • OnPointerClick(PointerEventData)
          • OnPointerEnter(PointerEventData)
          • OnSubmit(BaseEventData)
          • Option
      • Yarn.Unity.Samples Namespace
        • SampleRenderDetector
      • Yarn.Unity.UnityLocalization Namespace
        • LineMetadata
          • nodeName
          • tags
          • ShadowLineSource
        • UnityLocalisedLineProvider
          • DeregisterMarkerProcessor(string)
          • GetLocalizedLineAsync(Line,CancellationToken)
          • PrepareForLinesAsync(IEnumerable<string>,CancellationToken)
          • RegisterMarkerProcessor(string,IAttributeMarkerProcessor)
          • LocaleCode
    • Rust
      • bevy_yarnspinner
      • bevy_yarnspinner_example_dialogue_view
      • yarnspinner
Powered by GitBook
LogoLogo

Community

  • Discord
  • Bluesky
  • Mastodon

Support Our Work

  • Itch
  • Unity Asset Store
  • Patreon

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
  • Troubleshooting
  • Dialogue doesn't start
  • Dialogue text doesn't appear
  • Variable issues

Was this helpful?

Edit on GitHub
Export as PDF
  1. Yarn Spinner for Unity

Yarn Spinner in Unity Scenes

Learn the various components and assets used in getting Yarn Spinner up and running Unity scenes.

PreviousUnity Quick StartNextUnity Projects + Yarn Spinner

Last updated 16 days ago

Was this helpful?

This guide will walk you through setting up Yarn Spinner in your Unity project and getting a basic dialogue system running. It assumes you have created a new Unity project and .

1

Creating a Yarn Project

To organise your dialogue, you'll need to create a Yarn Project.

A Yarn Project is a special file that groups related Yarn Scripts together. It's essential for using dialogue in your game.

To create a Yarn Project:

  1. In the Unity Editor, open the Assets menu -> Yarn Spinner -> and choose Yarn Project

  2. Name your new Yarn Project file (e.g., MyGame)

  3. The Yarn Project will appear in your Assets folder

Yarn Projects include all Yarn Scripts in the same directory by default. You can modify the Source Files setting to include scripts from different locations.

Our recommended best practice is to create a Dialogue folder inside your assets, and store your Yarn Spinner Project(s) and Script(s) in it. The name of the folder is not significant, it's just useful to group your Yarn Spinner Script(s) and Project(s) together.

You can take a look at the Inspector of your Yarn Spinner Project to get a better understanding of what it's looking for:

You'll notice that it's including all .yarn scripts in the same folder as it, or in folders below/inside it. You can change this, or add specific Yarn Spinner Scripts if you'd like. You can also use this Inspector to change the default language for your Yarn Spinner Project, add additional localisations, and export your strings for translation.

For now, you don't need to touch anything here.

2

Writing Dialogue in Yarn Scripts

Now, let's create a Yarn Script to write your dialogue:

  1. Open the Assets menu -> Yarn Spinner > and choose Yarn Script

  2. Name your script (e.g., Introduction). This will create a file named Introduction.yarn

  3. Double-click the script to open it in the editor

Here's a simple example of dialogue written in Yarn:

title: Start
---
Player: Hello there!
NPC: Oh, hello! How can I help you today?
-> I need information.
    NPC: What would you like to know?
-> I'm just browsing.
    NPC: Feel free to look around!
-> Actually, I should go.
    NPC: No problem. Come back anytime!
    <<jump End>>
===

title: End
---
Player: Thanks for your help!
NPC: You're welcome! Have a nice day!
===

Save your changes. The script will be automatically included in your Yarn Project if it's in the same folder.

When writing dialogue, remember:

  • Each node begins with title: followed by the node name

  • The node's content starts after --- and ends with ===

  • Options are created using -> at the start of a line

  • Commands use <<command>> syntax

3

Setting Up the Dialogue System in Unity

To use your dialogue in-game, you need to add a Dialogue System to your scene:

  1. In your scene hierarchy, right-click and choose Yarn Spinner -> Dialogue System

  2. With the Dialogue System selected in the Hierarchy, locate its Dialogue Runner component in the Inspector.

  1. Drag your Yarn Project from the Assets view into the "Yarn Project" field in the Dialogue Runner:

  1. If you want dialogue to start automatically, check "Start Automatically" and set your starting node (often titled Start , by convention).

The Dialogue System prefab comes with several components:

  • Dialogue Runner: The core component that runs your dialogue

  • Line Presenter: Displays text dialogue to the player

  • Options Presenter: Shows choices for the player to select

  • Line Advancer: Allows the player to progress through dialogue

  • Markup Processor: Handles replacement .

4

Understanding Dialogue Presenters

Dialogue Presenters are components that display dialogue content to the player. There are a few different varieties. You can have multiple Dialogue Presenters in your scene, each handling different aspects of dialogue presentation. You'll often have a Line Presenter, to show regular lines, and an Options Presenter, to show options.

Line Presenter

A Line Presenter shows lines of dialogue. The default Line Presenter looks like this:

This default Line Presenter has some configuration options, including:

  • Text appearance and positioning

  • Character name display

  • Typewriter effect speed

  • Fading effects

  • Auto-advance settings

You can learn about them by selecting the Line Presenter in the Hierarchy:

And then looking at its Inspector:

Options Presenter

The Options Presenter displays for the player to select. The default Options Presenter looks like this:

You can configure:

  • Option appearance and positioning

  • List layout

  • Whether to show unavailable options

Line Advancer

The Line Advancer allows players to progress dialogue using input. You can configure it by:

  1. Selecting your Line Presenter in the hierarchy

  2. Finding the associated Line Advancer component

  3. Configuring the input method (keycode, button, etc.)

5

Variable Storage and Line Providers

Variable Storage

Variable Storage components keep track of variables in your dialogue:

  • By default, Yarn Spinner uses In-Memory Variable Storage (variables are lost when the game ends)

  • For persistent variables, create a custom Variable Storage that connects to your game's save system. You can learn to do this in our Variable Storage Guide.

To debug variables during development, use the Debug Text View property of the In-Memory Variable Storage component. By creating a in your Hierarchy, and assigning it to the Debut Text View field of the In Memory Variable Storage component attached to the Dialogue System, you can monitor variables in your game view for debug purposes:

Line Providers

Line Providers fetch the content for each line of dialogue:

  • Text Line Provider: Provides just the text of dialogue lines

  • Audio Line Provider: Provides text and associated audio clips

  • Unity Localised Line Provider: Works with Unity's Localization system

If you don't set a Line Provider, the system will create a Text Line Provider automatically. These components are all configured in the Dialogue Runner:

6

Testing Your Dialogue

To test your dialogue system:

  1. Make sure you have a Yarn Project asset and a Yarn Script asset, and that the Yarn Script is appropriately included with the Yarn Project:

  1. Add a Dialogue System to the scene, and assign the Yarn Project to it in the Inspector for the Dialogue Runner component attached to the Dialogue System:

  1. Also set the the Dialogue Runner to Start Automatically, and run the appropriate Yarn node:

  1. Press Play in the Unity Editor. Dialogue should begin!

If you didn't want dialogue to start automatically, you can trigger it by calling the StartDialogue() method on your Dialogue Runner. For example, you might trigger dialogue when a player presses a button near an NPC.

While testing, use the Unity Console to check for any errors in your Yarn scripts:

Troubleshooting

Dialogue doesn't start

  • Check if your Yarn Project is assigned to the Dialogue Runner

  • Verify that your Yarn Script contains a node with the name specified in "Start Node"

  • Check that you've ticked Start Automatically on the Dialogue Runner

  • Make sure there are no compilation errors in your Yarn Scripts

Dialogue text doesn't appear

  • Ensure the Line Presenter component is properly configured

  • Check that the Canvas Group and Text components are correctly assigned

Variable issues

  • For debugging, use the In-Memory Variable Storage's "Debug Text View" to see variable values

  • Make sure variables are declared with the correct type

installed the Yarn Spinner for Unity package
markup
options
TextMeshPro Text Component
Creating a new Yarn project
The Inspector for a Yarn Spinner Project asset.
The Yarn Project asset assigned to the correct field.
Setting the Yarn Spinner DIalogue Runner to start automatically and run the node titled Start.
The default Line Presenter.
The Line Presenter, selected in the Hierarchy.
The Line Presenter's Inspector.
Configuring the Line Advancer.
The In Memory Variable Storage component.
The bottom of the Inspector for a Yarn Project asset, showing the Yarn Scripts it is including.
The Yarn Project asset assigned to the Dialogue Runner.
Settings for starting automatically, and running a specific node, found on the Dialogue Runner component.
Dialogue running via Yarn Spinner for Unity and the default Line Presenter and Options Presenter.
The Unity console showing that we forgot to close a Yarn Command on line 11 of the Yarn Script.