InMemoryVariableStorage Class

An simple implementation of DialogueUnityVariableStorage, which stores everything in memory.

public class InMemoryVariableStorage : VariableStorageBehaviour, VariableStorage, IEnumerable<KeyValuePair<string, Value>>, IEnumerable


This class does not perform any saving or loading on its own, but you can enumerate over the variables by using a foreach loop:

// 'storage' is an InMemoryVariableStorage    
foreach (var variable in storage) {
    string name = variable.Key;
    Yarn.Value value = variable.Value;


Name Description
Clear() Removes all variables from storage.
GetValue(String) Retrieves a Value by name.
ResetToDefaults() Removes all variables, and replaces them with the variables defined in defaultVariables.
SetValue(String, Value) Stores a Value.
IEnumerable<KeyValuePair<String, Value».GetEnumerator() Returns an IEnumerator%601 that iterates over all variables in this object.
IEnumerable.GetEnumerator() Returns an IEnumerator that iterates over all variables in this object.


Name Description
defaultVariables The list of default variables that should be present in the InMemoryVariableStorage when the scene loads.


Defined in Unity/Assets/YarnSpinner/Scripts/InMemoryVariableStorage.cs, line 53.