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
        • Basics 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 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
    • 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(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(string,T)
        • IType
          • Description
          • Name
          • Parent
          • TypeMembers
        • ITypeMember
          • Type
        • IVariableAccess
          • GetVariableKind(string)
          • TryGetValue(string,T?)
          • Program
          • SmartVariableEvaluator
        • IVariableStorage
          • Clear()
          • SetValue(string,bool)
          • SetValue(string,float)
          • SetValue(string,string)
        • IYarnValue
          • ConvertTo()
        • 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
          • Line(string,string[])
          • ID
          • Substitutions
        • LineHandler
        • Logger
        • MemoryVariableStore
          • Clear()
          • GetVariableKind(string)
          • SetValue(string,bool)
          • SetValue(string,float)
          • SetValue(string,string)
          • TryGetValue(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(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(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(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
        • 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
        • 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
        • ICommand
          • Name
        • ILineProvider
          • DeregisterMarkerProcessor(string)
          • GetLocalizedLineAsync(Line,CancellationToken)
          • PrepareForLinesAsync(IEnumerable<string>,CancellationToken)
          • RegisterMarkerProcessor(string,Yarn.Markup.IAttributeMarkerProcessor)
          • LocaleCode
          • YarnProject
        • LineProviderBehaviour
          • DeregisterMarkerProcessor(string)
          • GetLocalizedLineAsync(Line,CancellationToken)
          • PrepareForLinesAsync(IEnumerable<string>,CancellationToken)
          • RegisterMarkerProcessor(string,IAttributeMarkerProcessor)
          • Start()
          • LocaleCode
          • YarnProject
        • 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
        • RegistrationType
          • Compilation
          • Runtime
        • YarnActionAttribute
          • Name
        • YarnCommandAttribute
        • YarnFunctionAttribute
      • 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
  • What we'll be covering
  • Line Providers and the Ineffable Issue of Asset Association
  • Play back

Was this helpful?

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

Voice Over and Localisation

Learn to add voice and localisation to your Yarn Spinner-powered projects.

PreviousMake Options TimeoutNextBackground Chatter

Last updated 9 hours ago

Was this helpful?

Dialogue in games often extends beyond simple text on screen. Many projects incorporate voice acting alongside written dialogue, and sometimes even more complex assets. This raises important questions about handling localisation—as the number of assets per line increases, so does the complexity of ensuring everything works together seamlessly.

This sample demonstrates Yarn Spinner's approach to localisation, asset association, and audio playback in a cohesive system.

The scene features a character floating in space, conversing with a disembodied voice. The main character's dialogue includes synchronized audio that drives lip movement animations. Unlike most samples, this one includes two identical scenes that differ only in their localisation implementation: one uses Yarn Spinner's built-in localisation system, while the other leverages Unity's Localisation package.

Note this isn't a lip-sync sample, we are just using lip-sync data as a way to demonstrate multiple non-out-of-the-box assets associated with a line.

What we'll be covering

  • Associating and playing audio with dialogue lines

  • Implementing custom line assets with lip-sync data and audio

  • Understanding the Built-in and Unity Localisation line providers

  • Localising both text and associated assets

Line Providers and the Ineffable Issue of Asset Association

The line provider is the component responsible for managing assets associated with dialogue. It supplies the content of each line—both text and related assets—to the various presenters in your game. Any object that implements the ILineProvider interface can serve as a line provider, and the dialogue runner consults this provider when it's time to present a line.

The dialogue runner itself doesn't know the actual content of lines—it only knows which line to run via the line's ID. When a line needs to be displayed, the line provider retrieves the content from the strings table, parses any markup, and collects any associated assets. If you need custom modifications or behaviors that apply to multiple lines, creating a custom line provider is generally the most effective approach.

Yarn Spinner includes two line providers out of the box:

  1. The built-in localised line provider (BuiltinLocalisedLineProvider) for projects without specific localisation workflows

  2. The Unity localised line provider (UnityLocalisedLineProvider) for projects using Unity's localisation system

While these providers function differently internally, they present the same interface to Yarn Spinner, so you can generally use whichever best fits your workflow without worrying about the implementation details.

You might notice both of these are based around your localisation approach and be wondering why. A line of text is intrinsically tied to localisation. Even if you aren't intending on translating or supporting more than your language, the work for a line provider to support one language is the same as supporting multiple languages. So we take a localisation first approach, even if you have only one localisation.

Asset Association

When the dialogue runner passes a line to your presenters, the LocalizedLine includes an optional Asset property that can contain any Unity Object (or null). Asset association is based on line ID, connecting relevant resources to specific dialogue lines.

If you have different needs for assets you'll have to create your own line provider which knows how to link the disparate pieces together and give it to the line as the assset for the line.

Built In Localisation

The built-in localisation system requires two components for each language:

  1. String Table: Essential for displaying lines. The base localisation (typically English) is automatically configured.

  2. Assets Folder (optional): Contains resources for that localisation.

The system searches the assets folder and matches assets to line IDs in the project. For this sample, we have a folder named LipSync-en containing the lip-sync data for English localisation.

CALLOUT: This isn't a lip-sync sample so for now they know it's a scriptable object that conforms to the IAssetProvider interface. It has a list of visemes and timeframes for when to show that viseme. It also has a reference to the audio file that this lip-sync event is connected to. For more details check out LipSyncedVoiceLine.cs.

The Yarn Project has this folder connected as the Assets folder for the English locale:

This connection ensures that when a presenter requests an asset (as the voice over presenter does), it receives the lip-sync asset with the same name as the line ID.

Unity Localisation

The Unity Localisation approach differs significantly. Instead of referencing files on disk, it uses tables to manage content. The sample scene includes preconfigured string and asset tables, which the Unity Localisation Line Provider references.

Rather than maintaining a list of locales, the project simply references a table collection:

Similarly, the Unity Localisation Line Provider doesn't configure the current language—it simply references the necessary string and asset tables:

The base locale's string table column automatically populates with values from the Yarn files. For additional languages, you'll need to add content to the table manually, typically using one of Unity's importers. This differs from the built-in localisation, where you manually associate a string table in the project.

Asset association also works differently with Unity Localisation. Since asset tables handle this functionality, Yarn Spinner provides a wizard accessible via Window -> Yarn Spinner -> Add Assets To Table Collection:

This wizard automatically detects locales from global settings. You'll need to:

  1. Connect the asset table to the Asset Table Collection field

  2. Set the asset type

  3. Drag asset folders for each locale into the appropriate slots

The system still matches assets to lines based on filename-to-line-ID mapping. After running the wizard, you can verify the configuration by examining the asset table:

At runtime, the Unity Localisation line provider uses these tables to find both text content and associated assets (like lip-sync data) for each line. The presenters receive complete, ready-to-use lines without needing to understand how the provider works.

IAssetProvider

The IAssetProvider interface addresses the challenge of handling unknown asset types. Default presenters (including the voice over presenter) are designed to work both independently and in combination, so they can't make assumptions about what kinds of assets they'll receive.

While most often the asset will be an audio file, many situations require something more complex. In this sample, we use a custom LipSyncedVoiceLine scriptable object that implements IAssetProvider. This object contains both an audio file and viseme timing data.

Through the IAssetProvider interface, different presenters can request specific asset types in a consistent way without worrying about implementation details. Conforming to this interface requires implementing just two methods: TryGetAsset<T> and GetAssetsOfType<T>.

If you're not using default presenters and don't need interoperability between assets and views, you can use whatever asset types you prefer. However, if you want compatibility between custom and default presenters, implementing IAssetProvider is highly recommended.

Play back

The remaining components of the sample are more straightforward, as the localisation and line providers handle most of the complexity. Two presenters are particularly relevant:

Voice Over Presenter

This presenter requires an audio asset to function. It first checks if the line has an associated asset, and whether that asset is audio. If so, it plays the audio directly.

If the asset isn't audio but implements IAssetProvider (as in this sample), the presenter requests an audio asset from the provider and then plays it. This demonstrates the primary purpose of the IAssetProvider interface—allowing different types of data to be bundled into a single container.

TextureLipSyncView

This component has a more straightforward implementation. Since we know the asset type in this sample, we can skip some checks and directly request lip-sync timing data from the IAssetProvider. With this data, the component modifies the character's face to match the appropriate visemes at the correct times during audio playback.

We assume you are already fairly comfortable with using Unity localisation. For information on how to get started with it if you are new to it, check out the .

The Unity Localisation line provider for the sample project
The Unity Localisation asset associator
The asset table for the sample
official Unity docs
Folder of lip-sync data assets
The built-in localisation version of the sample project
The Unity Localisation version of the sample project

You can learn how to add the Yarn Spinner for Samples to your project over at Samples.