Pardon our dust! Docs for Yarn Spinner for Unity 3.2 and Yarn Spinner for Godot C# are on docs.yarnspinner.dev (the old docs site). Docs for Yarn Spinner for Unity 3.3 (pre-release, out ASAP), Yarn Spinner for Godot GDScript and Yarn Spinner for Unreal Engine (work in progress) are on /docs/ (the new docs site).

StandardLibrary

Provides definitions and implementations for all the built in functions and operators
public sealed class StandardLibrary

Inherits from System.Object

#Nested Types

  • Contains the names of standard library functions whose implementations are expected to be provided by the game engine.

#Methods

#AllFunctions()

Creates all function definitions of the built in functions
public static Dictionary<string, FunctionType> AllFunctions()

Returns Dictionary: A dictionary of every function and it's definition keyed by name

Exceptions

  • System.ArgumentException
    If an expected function doesn't exist

#CallFunc(string, Value[], CancellationToken)

Invoke the function
public static ValueTask<Yarn.Value> CallFunc(string functionName, Value[] parameters, CancellationToken token)

Parameters

  • functionNamestring
    The name of the function
  • parametersYarn.Value[]
    the list of parameters the function needs
  • tokenSystem.Threading.CancellationToken
    Cancellation token to use

Returns ValueTask: The Yarn Value that is the result of the function

Exceptions

  • System.ArgumentException
    If the function doesn't exist in the standard library

#GenerateUniqueCommandBlockViewedVariableName(string, string, int)

Gets the name of the boolean variable that stores whether or not the content inside a once block has been seen by the player before.
public static string GenerateUniqueCommandBlockViewedVariableName(string sourceFileName, string node, int lineNumber)

Parameters

  • sourceFileNamestring
    The absolute path to the yarn file that contains the once block.
  • nodestring
    the node that contains the once block.
  • lineNumberint
    The line number in the editor that opens the once block.

Returns String: A variable name.

This is an inherently unstable identifer as it relies of layout attributes of the yarn code. Later versions of Yarn Spinner will likely change how this works to be more stable. Moreso than GenerateUniqueContentViewedVariableName this is only really useful during development. Sorry.

#GenerateUniqueContentViewedVariableName(string)

Gets the name of the boolean variable that stores whether the content identified by lineID has been seen by the player before.
public static string GenerateUniqueContentViewedVariableName(string lineID)

Parameters

  • lineIDstring
    The line ID to generate a variable name for.

Returns String: A variable name.

The value provided should be the full line ID without the #. So if you have a line Alice: this is my once line <<once>> #line:abc123 the input should be "line:abc123".

#GenerateUniqueVisitedVariableForNode(string)

Generates a unique tracking variable name. This is intended to be used to generate names for visting. Ideally these will very reproduceable and sensible. For now it will be something terrible and easy.
public static string GenerateUniqueVisitedVariableForNode(string nodeName)

Parameters

  • nodeNamestring
    The name of the node that needs to have a tracking variable created.

Returns String: The new variable name.

#TryGetFunction(string, FunctionType)

Finds the definition (so the parameters and return) for the requested function
public static bool TryGetFunction(string functionName, out FunctionType function)

Parameters

  • functionNamestring
    the name of the function
  • The function definition

Returns Boolean: true if the function has a definition

Generated from Yarn Spinner for Unity 3.3.