GnosisNode
GnosisNode is a lightweight struct (a “smart facade”) that acts as a proxy to the data in the store. It provides a familiar, JSON-like API for traversing and modifying data.
Value Types
A GnosisNode can represent:
- Primitives:
int,float,bool,long,string. - Unity Types:
Vector2,Vector3,Color. - Collections:
Object(string-keyed map) andList.
Traversal & Dotted Notation
The power of GnosisNode comes from its ability to resolve dotted paths (e.g., stats.player.hp).
- Access by Property:
node["stats"] - Access by List Index:
node[0] - Deep Traversal (Recursive):
node["stats"]["player"]["hp"] - Dotted Path (Faster):
node["stats.player.hp"]
SetDeep and GetAtPath
GetAtPath(string path): Safely resolves a path and returns an invalid node if any part is missing.SetDeep(string path, GnosisValue value): Automatically creates any missing nested objects along the path before setting the final value.
Type-Safe Conversions
Nodes can be implicitly cast to their primitive equivalents:
int hp = node["player.hp"];
string name = node["player.name"];
bool isAlive = node["player.isAlive"];Last updated on