Yarn Spinner for Unity 3.3 API Reference
#Yarn namespace
Contains classes for working with compiled Yarn programs.
- Command structA command, sent from the Dialogue to the game.
- ConstantTypeProperty classRepresents a property that belongs to a type and contains a read-only value.
- Dialogue classCo-ordinates the execution of Yarn programs.
- DialogueException class
- EnumBase classThe base type for all enumeration types.
- EnumType classA type that represents enumerations.
- FunctionType classA type that represents a function.
- Header class
- IDialogueResponder interfaceThe responder is responsible for handling important dialogue events. This includes all user facing content events (such as lines and options) as well as non-usesr facing events (such as node enters and exits)
- IMarkupParser interfaceContains methods for parsing raw text into a MarkupParseResult.
- ISmartVariableEvaluator interfaceContains methods for evaluating the value of smart variables
- IType interfaceDefines properties that describe a type in the Yarn language.
- ITypeMember interfaceProvides properties used to work with members of a type.
- IVariableAccess interfaceProvides a mechanism for retrieving values.
- IVariableStorage interfaceProvides a mechanism for storing values.
- IYarnValue interfaceRepresents a read-only value in the Yarn Spinner virtual machine.
- Line structA line of dialogue, sent from the Dialogue to the game.
- Logger delegateRepresents a method that receives diagnostic messages and error information from a Dialogue.
- MemoryVariableStore classA simple concrete implementation of IVariableStorage that keeps all variables in memory.
- Node classA node of Yarn script, contained within a Program, and containing
Yarn.Instructions. - OptionSet struct
- Program classA compiled Yarn program.
- StandardLibrary classProvides definitions and implementations for all the built in functions and operators
- TypeBase classProvides the base class for all concrete types.
- Types classContains the built-in types available in the Yarn language.
- Value classA value from inside Yarn.
- VariableKind enumRepresents different kinds of variables that can be fetched from a Dialogue using TryGetValue<T>(string,T?).
#Yarn.Compiler namespace
Contains classes for compiling Yarn code.
- CompilationJob structAn object that contains Yarn source code to compile, and instructions on how to compile it.
- CompilationResult classThe result of a compilation.
- Compiler classCompiles Yarn code.
- Declaration classRepresents a variable declaration
- DeclarationBuilder classProvides methods for constructing Declaration objects.
- Definitions classDefinitions represent external actions that are part of the Project and are used in different ways by different parts of Yarn Spinner. These are primarily constructed by providing the YSLS json file but you can manually create one for tests.
- Creates line ids in a form that attempts to approximate how a person would manually tag lines.
- Diagnostic classA diagnostic message that describes an error, warning or informational message that the user can take action on.
- DiagnosticDescriptor classDescribes a diagnostic message with a unique code and template.
- EnumTypeBuilder classProvides methods for constructing EnumType objects.
- FileParseResult structContains the result of parsing a single file of source code.
- FunctionTypeBuilder classProvides methods for constructing FunctionType objects.
- ILineTagGenerator interfaceLine tag generators are responsible for producing unique line IDs in a Yarn Spinner project.
- IndentAwareLexer classA Lexer subclass that detects newlines and generates indent and dedent tokens accordingly.
- ISourceInput interfaceAn input into a Yarn Spinner compilation.
- JumpInfo classinformation about a jump or detour from one node to another
- JumpType enumtype of jump between nodes
- NodeDebugInfo classContains debug information for a node in a Yarn file.
- NodeMetadata classcontains metadata about a node extracted during compilation for use by language server features this is different from nodedebuginfo which is for instruction level debugging
- OptionInfo classinformation about a shortcut option within a node
- Contains extension methods for
ParserRuleContextobjects. - Position classRepresents a position in a multi-line string.
- Project classYarn Projects represent instructions on where to find Yarn scripts and associated assets, and how they should be compiled.
- ProjectDebugInfo classContains debugging information for compiled Yarn Projects.
- RandomLineTagGenerator classA line tag generator that produces line IDs containing a random hexadecimal string.
- Range classRepresents a range of text in a multi-line string.
- StringInfo structInformation about a string. Stored inside a string table, which is produced from the Compiler.
- Utility classUtility methods for working with line tags.
#Yarn.Compiler.Upgrader namespace
Contains classes for upgrading Yarn code to more recent versions of the language.
- LanguageUpgrader classContains methods for upgrading the syntax of Yarn scripts.
- TextReplacement structContains information describing a replacement to make in a string.
- UpgradeJob structAn upgrade job.
- UpgradeResult structThe result of an upgrade.
- UpgradeType enumSpecifies what kind of language upgrading should be applied.
#Yarn.Markup namespace
Contains classes for working with markup in Yarn lines.
- BuiltInMarkupReplacer classA marker processor that handles the built-in markers
[select][plural], and[ordinal]. - IAttributeMarkerProcessor interfaceProvides a mechanism for producing replacement text for a marker.
- LineParser classParses text and produces markup information.
- MarkupAttribute structRepresents a range of text in a marked-up string.
- MarkupParseException classAn exception representing something going wrong when parsing markup.
- MarkupParseResult structThe result of parsing a line of marked-up text.
- MarkupProperty structA property associated with a MarkupAttribute.
- MarkupValue structA value associated with a MarkupProperty.
- MarkupValueType enumA type of MarkupValue.
- ReplacementMarkerResult structA bundle of results from processing replacement markers.
- TagType enumA type of
Yarn.Markup.MarkupAttributeMarker.
#Yarn.Saliency namespace
Contains classes for choosing the most relevant content out of a set of possible options.
- A content saliency strategy that returns the first of the best, least-recently seen choices from the provided options.
- BestSaliencyStrategy classA content saliency strategy that returns the best of the provided options.
- Indicates what type of content a ContentSaliencyOption represents.
- ContentSaliencyOption classRepresents a piece of content that may be selected by an IContentSaliencyStrategy.
- Contains extension methods for
System.Collections.Generic.IEnumerable`1. - FirstSaliencyStrategy classA content saliency strategy that always returns the first non-failing item in the list of available options.
- IContentSaliencyStrategy interfaceContains methods for choosing a piece of content from a collection of options.
- A content saliency strategy that returns a random choice of the best, least-recently seen choices from the provided options.
#Yarn.Shared namespace
- ActionType enumRepresents the types of actions we encounter while scanning code. Most of the time will be Command or Function
- DeclarationType enumRepresents the way the action was registered. Necessary because there are some differences in diagnostics depending on how an action has been registered.
- ILogger interfaceProvides a common interface to logging during source gen to support any different type of logger. Technically for the source gen system but I suppose anything can use it...
- NullLogger classThe standard logger that is used when logging isn't necessary. This exists so that you don't have to null check every single instance of the logger.
- ParameterTypes enumRepresents the type a parameter in an action can be. Is overly simplified and needs to go hand in hand with a T:Yarn.Shared.NamedType to ge fully useful but there is loads of easier filtering that can be done with this simpler representation of a type.
- ReturnType enumA Yarn Normalised form of the allowed return types. In Yarn a function that returns a float or an int are effectively the same thing, they both return a number. This enum represents a simpler cutdown list of those types, additionally handles when
- Action typeRepresents the concept of a yarn action, so either a command or a function
- BasicParameter typeRepresents a parameter that is one of the basic types, so string, numbers, bools.
- ComponentParameter typeRepresents a parameter that is a Unity Component subclass (often a MonoBehaviour).
- ConverterParameter typeRepresents a parameter who's type and value comes from being run through a Yarn Converter attributed method.
- DocumentationPayload typeRepresents a more easily digestable form of the C# docstring. Intended to be used to populate the descriptions in ysls files
- EnumParameter typeRepresents a parameter that is an Enum.
- GameObjectParameter typeRepresents a parameter that is a Unity GameObject.
- InvalidAction typeSpecific subtype of action that represents an action that is invalid. Why it is invalid could be to any number of reasons, but this action cannot be invoked.
- NamedType typeRepresents a simpler and more sourcegen cache friendly version of roslyns
INamedTypeSymbol. This could be a lot more advanced but in practice we've seen this works well enough to give us the necessary functionality of the roslyn equivalent. - Parameter typeRepresents a single parameter inside a Yarn action.
- TokenParameter typeRepresents a parameter that is a cancellation token
- UnknownParameter typeRepresents a parameter whos type either is something we can't handle in a Yarn action, or one whos conversion hasn't been resolved yet.
- YarnConverter typeRepresents the concept of a yarn converter method, what type it supports and how to call it.
- YarnEnum typeRepresents the concept of a Yarn enum including it's backing type
- YarnSpecialType enumThe Yarn source generator specific form of the Roslyn
SpecialType. Has far less fields but we need less so it's fine.
#Yarn.Unity namespace
Contains classes for working with Yarn Spinner in the Unity game engine.
- ActionExtensions classProvides a series of extensions and helper methods reflection types and their T:Yarn.Shared.Action (and related) forms.
- ActionInvoker class
- ActionMarkupHandler classThis is an abstract monobehaviour that conforms to the IActionMarkupHandler interface.
- Contains extension methods for IActionRegistration objects.
- Actions classThe "default" action registration system used
- Culture structHolds information about a language.
- Cultures classProvides access to all Cultures supported by Yarn Spinner.
- DialogueOption classRepresents a single option in an option group.
- DialoguePresenterBase classA
MonoBehaviourthat is informed of important events occurring in your dialogue, when it receives them from a DialogueRunner and are used for a variety of different tasks. Primarily these are how you show lines and options to the player. - DialogueReference classStores a reference to a dialogue node in a Yarn Project.
- DialogueRunner class
- Effects classProvides common effects used by various DialoguePresenterBase implementations.
- IActionMarkupHandler interfaceA IActionMarkupHandler is an object that reacts to the delivery of a line of dialogue, and can optionally control the timing of that delivery.
- IActionRegistration interfaceContains methods that allow adding and removing Yarn commands and functions.
- IAssetProvider interfaceContains methods for accessing assets of a given type stored within an object.
- IAsyncTypewriter interfaceAn object that can handle delivery of a line's text over time.
- IGeneratedVariableStorage interfaceAn interface that works with GeneratedVariableStorageExtensions to add helper methods used by generated variable storage classes.
- ILineAdvancerInput interface
- ILineProvider interfaceContains methods for retrieving user-facing localized content, given non-localized line IDs.
- InMemoryVariableStorage classA simple implementation of VariableStorageBehaviour.
- InputSystemAvailability class
- InstantTypewriter classAn implementation of IAsyncTypewriter that delivers all content instantly, and invokes any IActionMarkupHandlers along the way as needed.
- This type exists to allow connecting up interfaces into objects via the inspector.
- LetterTypewriter classAn implementation of IAsyncTypewriter that delivers characters one at a time, and invokes any IActionMarkupHandlers along the way as needed.
- LineAdvancer classA dialogue presenter that listens for user input and sends requests to a DialogueRunner to advance the presentation of the current content, either by asking a dialogue runner to hurry up its delivery, advance to the next piece of content, or cancel the entire dialogue session.
- LineCancellationToken structA Line Cancellation Token stores information about whether a dialogue presenter should stop its delivery.
- LineMetadata classRepresents the bundles of metadata across all lines and a mechanism to retrieve a specific metadata bundle for a line.
- LinePresenter classA Dialogue Presenter that presents lines of dialogue, using Unity UI elements.
- An ActionMarkupHandler that provides the little advance button on the built in LinePresenter prefab.
- LineProviderBehaviour classA
MonoBehaviourthat produces LocalizedLines, for use in Dialogue Presenters. - Localization classA localization is a bundle of strings and assets for a particular culture
- LocalizationType enumWhat type of localisation is this project using, the built in or the unity loc package?
- LocalizedLine classRepresents a line, ready to be presented to the user in the localisation they have specified.
- MarkupPalette classRepresents a collection of marker names and colours.
- OptionItem classRepresents a single item (so a choice that can be made) in a group of options. Is used by the OptionsPresenter to populate it's UI with choices for the player to make
- OptionsPresenter classReceives options from a DialogueRunner, and displays and manages a collection of OptionItem views for the user to choose from.
- PauseEventProcessor classAllows pausing the current typewriter through [pause/] markers.
- ReplacementMarkupHandler classAn attribute marker processor receives a marker found in a Yarn line, and optionally rewrites the marker and its children into a new form.
- SerializableDictionary class
- StringTableEntry structRepresents a single entry in the string table
- StyleMarkerProcessor classAn attribute marker processor that inserts TextMeshPro style tags where Yarn Spinner
[style]tags appear in a line. - VariableStorageBehaviour classA
MonoBehaviourthat a DialogueRunner uses to store and retrieve variables. - VoiceOverPresenter classA subclass of DialoguePresenterBase that plays voice-over
AudioClips for lines of dialogue. - WordTypewriter classAn implementation of IAsyncTypewriter that delivers words one at a time, and invokes any IActionMarkupHandlers along the way as needed.
- YarnActionAttribute attributeAbstract basetype of the action based attributes. Used during action collection and analysis
- YarnCommandAttribute classAn attribute that marks a method on an object as a command.
- YarnConverterAttribute attributeAttribute that marks a command as being a converter for a type used in commands and functions.
- YarnFunctionAttribute classMarks the method as a function to be registered with the dialogue runner.
- YarnProject classThe scrobject that is the Yarn Project.
- YarnTask structYarn Task is a convenience Awaiter that acts as a wrapper type around the underlying Awaiter that your Unity project is using.
- YarnTask<T> structYarn Task is a convenience Awaiter that acts as a wrapper type around the underlying Awaiter that your Unity project is using.
- YarnTaskCompletionSource classProvides a mechanism to create a Yarn Task and set it as completed or cancelled from a non-async environment.
- Provides a mechanism to create a Yarn Task and set it as completed or cancelled from a non-async environment.
- YarnTaskExtensions class
#Yarn.Unity.LineAdvancerInput namespace
- InputActions class
- KeyCodes class
- LegacyInputAxes class
#Yarn.Unity.Samples namespace
- SampleRenderDetector classDetects if the render pipeline is different from the one the samples were created with, and warn you that things might look odd.
#Yarn.Unity.Shim namespace
- AutoStaticsCleanupAttribute attribute
- NoAutoStaticsCleanupAttribute attribute
#Yarn.Unity.UnityLocalization namespace
Contains classes for working with the Unity Localization system and Yarn Spinner.
- LineMetadata classContains Yarn Spinner related metadata for Unity string table entries.
- A line provider that uses the Unity Localization system to get localized content for Yarn lines.
#Yarn.Utility namespace
Contains utility classes used by Yarn Spinner.
- CRC32 classProvides a method for generating CRC32 hashes of strings.
#Global Namespace
- PaletteMarkerProcessor classAn attribute marker processor that uses a MarkupPalette to apply TextMeshPro styling tags to a line.
Generated from Yarn Spinner for Unity 3.3.