All pages
Powered by GitBook
1 of 11

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

showDebug

Field in InMemoryVariableStorage

Summary

public bool showDebug;

Clear()

Method in

Summary

Removes all variables from storage.

GetDebugList()

Method in

Summary

public override void Clear()
InMemoryVariableStorage
public string GetDebugList()
InMemoryVariableStorage

InMemoryVariableStorage

Class in Yarn.Unity

Inherits from VariableStorageBehaviour

Summary

A simple implementation of VariableStorageBehaviour.

Remarks

This class stores variables in memory, and is erased when the game exits.

This class also has basic serialization and save/load example functions.

You can also enumerate over the variables by using a foreach loop:

Note that as of v2.0, this class no longer uses Yarn.Value, to enforce static typing of declared variables within the Yarn Program.

Fields

Name
Description

Methods

Name
Description

Contains(string)

Method in InMemoryVariableStorage

Summary

returns a boolean value representing if the particular variable is inside the variable storage

public override bool Contains(string variableName)

Parameters

Name
Description
public class InMemoryVariableStorage : VariableStorageBehaviour, IEnumerable<KeyValuePair<string, object>>

string variableName

Retrieves a Value by name.

showDebug

Clear()

Removes all variables from storage.

Contains(string)

returns a boolean value representing if the particular variable is inside the variable storage

GetAllVariables()

GetDebugList()

SetAllVariables(Dictionary<string, float>,Dictionary<string, string>,Dictionary<string, bool>,bool)

// 'storage' is an InMemoryVariableStorage
foreach (var variable in storage) {
string name = variable.Key;
System.Object value = variable.Value;
}
SetValue(string,bool)
SetValue(string,float)
SetValue(string,string)
TryGetValue(string,T)

SetValue(string,float)

Method in InMemoryVariableStorage

Summary

public override void SetValue(string variableName, float floatValue)

Parameters

Name
Description

SetValue(string,bool)

Method in InMemoryVariableStorage

Summary

public override void SetValue(string variableName, bool boolValue)

Parameters

Name
Description

SetValue(string,string)

Method in InMemoryVariableStorage

Summary

public override void SetValue(string variableName, string stringValue)

Parameters

Name
Description

SetAllVariables(Dictionary<string, float>,Dictionary<string, string>,Dictionary<string, bool>,bool)

Method in

Summary

Parameters

GetAllVariables()

Method in

Summary

string variableName

float floatValue

string variableName

bool boolValue

string variableName

string stringValue

Name
Description

Dictionary<string, float> floats

Dictionary<string, string> strings

Dictionary<string, bool> bools

bool clear

public override void SetAllVariables(Dictionary<string, float> floats, Dictionary<string, string> strings, Dictionary<string, bool> bools, bool clear = true)
InMemoryVariableStorage
public override (Dictionary<string, float>, Dictionary<string, string>, Dictionary<string, bool>) GetAllVariables()
InMemoryVariableStorage

TryGetValue(string,T)

Method in InMemoryVariableStorage

Summary

Retrieves a Value by name.

public override bool TryGetValue<T>(string variableName, out T result)

Parameters

Name
Description

Returns

The Value . If a variable by the name of variableName is not present, returns a value representing null.

string variableName

The name of the variable to retrieve the value of. Don't forget to include the "$" at the beginning!

T result