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).

YarnNativeCompiler

Wrapper for the bundled native Yarn Spinner compiler. Editor-only — used by the importer to compile .yarn files without requiring the ysc CLI tool or .NET runtime on the user's machine.
class_name YarnNativeCompiler
extends RefCounted

Inherits from RefCounted

#Constants

#NATIVE_BIN_DIR

const NATIVE_BIN_DIR = "res://addons/yarn_spinner/native/bin/"

#NATIVE_BIN_NAMES

const NATIVE_BIN_NAMES = {"linux-arm64": "ysc-native-linux-arm64", "linux-x64": "ysc-native-linux-x64", "macos-universal": "ysc-native-macos-universal", "windows-arm64": "ysc-native-windows-arm64.exe", "windows-x64": "ysc-native-windows-x64.exe"}

#Methods

#compile(Array[Dictionary], Array[Dictionary], int)

Compile Yarn source files using the native compiler. Input: array of dictionaries [{ "fileName": "X.yarn", "source": "..." }] declarations (optional): functions the game provides, so the compiler knows their types, as [{ name, parameters: [type, ...], returnType, variadicParameterType (optional), description (optional) }]. Types are "string", "number", "bool" or "any". Entries with a missing or "any" return type are ignored. Returns: Dictionary with: success: bool program: PackedByteArray (compiled protobuf, empty on error) compiler_failed: bool (the compiler could not run, as opposed to reporting errors) string_table: Dictionary { line_id: { text, nodeName, lineNumber, fileName, isImplicitTag, metadata } } declarations: Array of { name, type, isEnum, description, isInlineExpansion, sourceFileName, defaultValue } enums: Array of { name, description, rawType, cases: [{ name, description, value }] } diagnostics: Array of { message, severity, fileName, line, column, code }
static func compile(files: Array[Dictionary], declarations: Array[Dictionary] = [], language_version: int = 0) -> Dictionary

Parameters

  • filesArray[Dictionary]
  • declarationsArray[Dictionary]
  • language_versionint

Returns Dictionary

#get_native_bin_path()

Returns the path to the native compiler binary for this platform and architecture, or an empty string if there isn't one.
static func get_native_bin_path() -> String

Returns String

#is_available()

Returns true if the native compiler binary is available.
static func is_available() -> bool

Returns bool

#tag_lines(Array[Dictionary], PackedStringArray, String)

static func tag_lines(files: Array[Dictionary], excluded_line_ids: PackedStringArray = PackedStringArray(), tagger: String = "random") -> Dictionary

Parameters

  • filesArray[Dictionary]
  • excluded_line_idsPackedStringArray
  • taggerString

Returns Dictionary

Generated from Yarn Spinner for Godot GDScript 3.3.