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

Declaration

Represents a variable declaration
public class Declaration

Inherits from System.Object

#Fields

#ExternalDeclaration

The string used for SourceFileName if the Declaration was found outside of a Yarn source file.
public const string ExternalDeclaration = "(External)";

Type String

#Properties

#DeclarationParserContext

Gets or sets the parser context for the declaration statement provided for this variable, if any. This is only valid for variable declarations, not functions (because functions aren't declared inside Yarn scripts.)
public YarnSpinnerParser.Declare_statementContext? DeclarationParserContext { get; internal set; }

Type Declare_statementContext

#DefaultValue

Gets the default value of this Declaration, if no value has been specified in code or is available from a Dialogue's IVariableStorage.
public IConvertible? DefaultValue { get; internal set; }

Type IConvertible

#Dependencies

Gets the collection of Declaration objects that this Declaration depends upon the value of.
public IEnumerable<Declaration> Dependencies { get; internal set; }

Type IEnumerable

#Dependents

Gets the collection of Declaration objects whose value depends upon this Declaration.
public IEnumerable<Declaration> Dependents { get; internal set; }

Type IEnumerable

#Description

Gets a string describing the purpose of this Declaration.
public string? Description { get; internal set; }

Type String

#InitialValueParserContext

Gets or sets the parser context for the initial value provided in this variable's 'declare' statement, if any. This is only valid for variable declarations, not functions (because functions don't have a value.)
public YarnSpinnerParser.ExpressionContext? InitialValueParserContext { get; set; }

Type ExpressionContext

#IsImplicit

Gets a value indicating whether this Declaration was implicitly inferred from usage.
public bool IsImplicit { get; internal set; }

Type Boolean

#IsInlineExpansion

Gets a value indicating that this Declaration does not refer to a stored variable, and instead represents an inline-expanded expression (a 'smart variable').
public bool IsInlineExpansion { get; internal set; }

Type Boolean

#IsVariable

Gets a value indicating whether this Declaration represents a variable, and not a function.
public bool IsVariable { get }

Type Boolean

#Name

Gets the name of this Declaration.
public string Name { get; internal set; }

Type String

#Range

Gets the range of text at which this declaration occurs.
public Range Range { get; internal set; }

Type Range

This range refers to the declaration of the symbol itself, and not any syntax surrounding it. For example, the declaration <<declare $x = 1>> would have a Range referring to the $x symbol.

#SourceFileLine

Gets the line number at which this Declaration was found in the source file.
public int SourceFileLine { get }

Type Int32

If this Declaration was not found in a Yarn source file, this will be -1.

#SourceFileName

Gets the name of the file in which this Declaration was found.
public string SourceFileName { get; internal set; }

Type String

If this Declaration was not found in a Yarn source file, this will be ExternalDeclaration.

#SourceNodeName

Gets the name of the node in which this Declaration was found.
public string? SourceNodeName { get; internal set; }

Type String

If this Declaration was not found in a Yarn source file, this will be null.

#Type

Gets the type of the variable, as represented by an object that implements IType.
public IType Type { get; internal set; }

Type IType

#Methods

#CreateVariable(string, IType, IConvertible, string?)

Creates a new instance of the Declaration class, using the given name, type and default value.
public static Declaration CreateVariable(string name, IType type, IConvertible defaultValue, string? description = null)

Parameters

  • namestring
    The name of the new declaration.
  • The type of the declaration.
  • defaultValueSystem.IConvertible
    The default value of the declaration. This must be a string, a number (integer or floating-point), or boolean value.
  • descriptionstring
    The description of the new declaration.

Returns Declaration: A new instance of the Declaration class.

#ToString()

public override string ToString()

Returns String

Generated from Yarn Spinner for Unity 3.3.