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

MemoryVariableStore

A simple concrete implementation of IVariableStorage that keeps all variables in memory.
public class MemoryVariableStore : IVariableStorage

Inherits from System.Object

Implements Yarn.IVariableStorage, Yarn.IVariableAccess

#Properties

#Program

Gets or sets the Yarn Program that stores information about the initial values of variables, and is able to produce values for smart variables.
public Program? Program { get; set; }

Type Program

#SmartVariableEvaluator

Gets or sets the object to use when evaluating smart variables.
public ISmartVariableEvaluator? SmartVariableEvaluator { get; set; }

Type ISmartVariableEvaluator

#Methods

#Clear()

Removes all variables from storage.
public void Clear()

#GetVariableKind(string)

Gets the kind of variable named name.
public VariableKind GetVariableKind(string name)

Parameters

  • namestring
    The name of the variable.

Returns VariableKind: A VariableKind enum representing the kind of the variable named name.

#SetValue(string, bool)

Stores a bool in this VariableStorage.
public virtual void SetValue(string variableName, bool boolValue)

Parameters

  • variableNamestring
    The name to associate with this variable.
  • boolValuebool
    The boolean value to store.

#SetValue(string, float)

Stores a float in this VariableStorage.
public virtual void SetValue(string variableName, float floatValue)

Parameters

  • variableNamestring
    The name to associate with this variable.
  • floatValuefloat
    The number to store.

#SetValue(string, string)

Stores a string in this VariableStorage.
public virtual void SetValue(string variableName, string stringValue)

Parameters

  • variableNamestring
    The name to associate with this variable.
  • stringValuestring
    The string to store.

#TryGetValue<T>(string, T?)

Given a variable name, attempts to fetch a value for the variable, either from storage, initial values found in Program, or by evaluating a smart variable found in Program.
public virtual bool TryGetValue<T>(string variableName, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result)

Type Parameters

  • T
    The type of the value to return. The fetched value will be converted to this type, if possible.

Parameters

  • variableNamestring
    The name of the variable.
  • resultT
    If this method returns true, this parameter will contain the fetched value.

Returns Boolean: true if a value could be fetched; false otherwise.

Generated from Yarn Spinner for Unity 3.3.