Class VariableStore
Centralized variable storage with global and per-asset local scoping.
Resolution order: local (current asset) -> global.
Inheritance
VariableStore
Assembly: .dll
Syntax
public static class VariableStore
Methods
|
Edit this page
View Source
ClearAll()
Clears all variables, both global and local.
Declaration
public static void ClearAll()
|
Edit this page
View Source
ClearLocals(string)
Clears local variables for a specific asset.
Declaration
public static void ClearLocals(string assetName)
Parameters
| Type |
Name |
Description |
| string |
assetName |
|
|
Edit this page
View Source
ExportState()
Exports a snapshot of all variable state for serialization by a save system.
Declaration
public static VariableSnapshot ExportState()
Returns
|
Edit this page
View Source
ImportState(VariableSnapshot)
Restores variable state from a previously exported snapshot. Clears all
existing variables before importing.
Declaration
public static void ImportState(VariableSnapshot snapshot)
Parameters
|
Edit this page
View Source
IsDefined(string, string)
Checks whether a variable exists in any scope, including variables
explicitly set to null.
Declaration
public static bool IsDefined(string assetName, string name)
Parameters
Returns
|
Edit this page
View Source
Resolve(string, string)
Resolves a variable by name: checks local scope first, then global scope.
Returns null if the variable is not defined in any scope.
Declaration
public static object Resolve(string assetName, string name)
Parameters
Returns
|
Edit this page
View Source
Set(string, string, object)
Sets a variable using the scoping rule: if the variable already exists in any scope,
updates it in place. Otherwise creates it as a local in the given asset.
Declaration
public static void Set(string assetName, string name, object value)
Parameters
|
Edit this page
View Source
SetGlobal(string, object)
Sets a variable in the global scope, accessible from all dialogue files.
Declaration
public static void SetGlobal(string name, object value)
Parameters
|
Edit this page
View Source
SetLocal(string, string, object)
Sets a variable in a file-local scope, only accessible within that asset.
Declaration
public static void SetLocal(string assetName, string name, object value)
Parameters
|
Edit this page
View Source
ToString(object)
Converts a stored variable value to its string representation.
Used when substituting variables into dialogue text at runtime.
Declaration
public static string ToString(object value)
Parameters
| Type |
Name |
Description |
| object |
value |
|
Returns
Events
|
Edit this page
View Source
OnVariableChanged
Invoked whenever a variable is created or changed. Parameters are
(variableName, oldValue, newValue). oldValue is null for new variables.
Declaration
public static event Action<string, object, object> OnVariableChanged
Event Type