Skip to content

Context API

CoffeeVampir3 edited this page Apr 11, 2021 · 3 revisions
public class Context

Context

The Context is simply a stack that gets passed around by the Graph Evaluator. It's constructed initially by the Graph Evaluator when you call initialize (Each context is unique to the local graph), and the evaluator passes it to each node it executes. The context is a good way to evaluate complex structures like Behaviour Trees, where you often need to return to a previous node.

public int Count()

The number of items in the stack.

public void Push(RuntimeNode node)

Pushes a new RuntimeNode to the top of the context.

public RuntimeNode Pop()

Pops the top of the stack off and returns it.

public readonly VirtualGraph virtGraph;

You can access the VirtualGraph that's current being evaluated in the context as well. This is left as an optional control for power users who want to access the graph's id or other components of the virtual graph.