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
On this page
  • Making or opening a Yarn file
  • Writing Yarn in Visual Studio Code
  • Opening a folder
  • Working with Yarn in Visual Studio Code
  • Working with nodes
  • Customising the Graph View
  • Using the Command Palette

Was this helpful?

Edit on GitHub
Export as PDF
  1. Writing Dialogue in Yarn
  2. ⌨️Editing with VS Code

Writing Yarn in VS Code

Learn how to use Yarn Spinner for Visual Studio Code as your Yarn editor.

PreviousInstalling the ExtensionNextPreviewing Your Dialogue

Last updated 1 year ago

Was this helpful?

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.

With the Yarn Spinner Visual Studio Code Extension installed, you can make new Yarn files, and edit existing ones, right inside the VS Code editor.

Making or opening a Yarn file

You can use the File menu -> New file command to make a new empty file. Simply save the file with a .yarn extension to activate the Yarn Spinner Extension features.

Yarn Spinner for Visual Studio Code is designed to work with a folder, not single files. If you're having trouble, open a folder with your .yarn file or files in it.

You can also open any existing .yarn file, or folder of .yarn files, using VS Code.

Writing Yarn in Visual Studio Code

Here, we'll walkthrough the process of using Yarn Spinner for Visual Studio Code to write .yarn stories.

Opening a folder

For this example, we'll start with an existing story (Chat.yarn) in a folder (YSDocsDemos):

You can download this folder as a .zip file here, if you want to follow along. TODO LINK.

If we open VS Code, the default screen will have an Open button right in the middle.

Click this button, or choose the File menu -> Open Folder..., and then open the folder containing your .yarn files:

When the folder opens, you'll see the sidebar of VS Code change to reflect the contents of the folder. You can click on a .yarn file to open it in the text editor:

Working with Yarn in Visual Studio Code

With a .yarn file open in VS Code, you can verify that the Yarn Spinner for Visual Studio Code Extension is active by looking in the bottom right-hand corner of the screen, and locating the words "Yarn Spinner":

The bottom right-hand corner of Visual Studio Code window will only show "Yarn Spinner" if both the Yarn Spinner for Visual Studio Code extension is installed, and the currently active file is recognised as a .yarn file by its extension.

You can use the text editing view to work with .yarn, and to write your narratives. The Yarn Spinner for Visual Studio Code extension provides all sorts of features to make this process easier.

For example, if you hold the Command key (on macOS) or the Control key (on Windows or Linux) and hover over names of nodes in, for example, `<<jump>> statements, you'll be able click on them to move the editor view to the Yarn that represents that node:

You'll also be offered autocomplete suggestions based on node names that exist in your project. For example, if you create a new <<jump>> statement, you'll be able to pick from your nodes:

If your Yarn projects also use variables, Yarn Spinner for VS Code will help out as well. For example, when you <<declare>> a new variable, you can add a comment with three / in front of it to provide a description of the variable:

Then, when you use the variable, you can hover over it in VS Code for a reminder of its purpose (and its default value):

Variable names will also autocomplete when you try and use them, and errors will be show if there are type isues. So, if you <<declare>> a variable to be a certain type, for example a boolean:

... and then attempt to use that variable in a way that would produce an error. For example, by attempting to assign a number to it, then Yarn Spinner for Visual Studio Code will show an error:

You'll also be able to see documentation comments from commands defined in your game's C# source code:

Working with nodes

While Yarn is a text based language, our Yarn Spinner for Visual Studio Code extension provides a handy Graph View. You can open the Graph View for whichever .yarn file you're currently working with by clicking the Graph View button in the top right-hand corner:

You might notice that, when you first look at the Graph View for a .yarn file, all the nodes appeared stacked on each other, like this:

To make sense of things, and better understand the <<jump>> use between nodes, you can rearrange the nodes by clicking and dragging to wherever you want them:

The position of the nodes will be stored in each node's header:

You can use the Add Node button, found at the top of the Graph View, to add new nodes. New nodes will appear in the Graph View, and in the text editor:

Double-clicking a node in the Graph View will jump to that node in the Text View:

If you have a lot of nodes, you can use the Jump to Node menu, in the top right-hand corner of the Graph View, to jump the Graph View to a specific node:

At any point you can also click Show in Graph View, found above each node in the Text View to jump the Graph View to it:

Customising the Graph View

You can add some additional metadata to the headers of each node to customise your Graph View, for ease of understanding the relationships between areas of your script. For example, if you add the color field to the header, you can colour-code your nodes:

You can use red, green, blue, orange, yellow, or purple. The colours that you see may be different, depending on your VS Code theme.

The color field works like any other header element, and goes below the title and above the ---:

title: NodeName
color: purple
---

===

You can also group your nodes by adding the group field to your node headers. For example, if you add group: Main_Options to the header of the Volcanos, Dogs, and Trees nodes, you'd end up with this:

Using the Command Palette

The VS Code Command Palette has a number of useful Yarn Spinner features as well. Summon the Command Palette by pressing Shift + Command + P (Mac) or Ctrl + Shift + P (Windows/Linux), or choosing the View menu -> Command Palette..., and type "Yarn Spinner" to filter the available commands to those provided by the Yarn Spinner for Visual Studio Code Extension:

From here you can Preview Dialogue, which will allow you to play through your narrative, right inside Visual Studio Code. To learn more about this, read Previewing Your Dialogue.

The Export Dialogue as HTML... option will export a self-contained playable version of your narrative as an HTML file, which is otherwise the same as the experience your get when previewing.

The Export Dialogue as Graph... option will allow you to export a .dot file of your graph. To learn about .dot files, check out the GraphViz documentation: https://graphviz.org/doc/info/lang.html

And finally, the Export Dialogue as Recording Spreadsheet... option will allow you to export a spreadsheet, which can be useful for voice actors recording dialogue.

A folder on disk containing a Yarn file.
The Open button on the Visual Studio Code start screen.
Opening a folder containing .yarn files.
Choosing a .yarn file to edit.
The status bar of VS Code showing that the Yarn Spinner extension is active.
Command/Control allows you to click a node name to jump to its definition.
Choosing a node to jump to with autocomplete.
Using the the special /// comment syntax to describe a variable.
Viewing a variable's description.
Using `<<declare>> to declare a boolean.
An error arising from trying to use a boolean like an integer.
Comments from C# commands in your Yarn scripts.
The Graph View button.
Nodes stacked on each other in the graph view.
Rearranging your nodes.
The position of each node is stored in the header.
The Add Node button.
Double-clicking a node in the Graph View to edit it in the Text View.
The Jump to Node menu.
Show in Graph View
Colour-coded nodes.
Grouping nodes in the Graph View.
The Command Palette