Skip to content

Graph Evaluator

CoffeeVampir3 edited this page Mar 21, 2021 · 4 revisions

public partial class GraphEvaluator

For Api see Graph Evaluator Api

Evaluator

The Graph Evaluator class is responsible for running your graphs. Simply add a GraphEvaluator to any object, for example a MonoBehaviour:

    public class GraphTester : MonoBehaviour
    {
        public GraphEvaluator evaluator;
       
        private void Start()
        {
            executor.Initialize();


            while(evaluator.Step() != null) {}
        }
    }

And make sure you set the reference for your graph controller in the inspector, then watch your graph walk four steps on start! Lets walk through this in parts, Initialize sets up the graph to be executable, see the low level details for more info on that. This operation is exetremely lightweight, so no stress if you need to make loads of graphs at once it's no problem. The only other thing happening here is Step which simply runs the current node's OnEvaluate function and returns wether or not there's a next node.