Running graphs from scripts
Running a graph from a script is easy. All you need is a reference to the ScriptGraphRunner component and run it. Here's a simple example:
using InsaneScatterbrain.ScriptGraph;
using UnityEngine;
public class RunningGraphFromScriptExample : MonoBehaviour
{
[SerializeField] private ScriptGraphRunner graphRunner;
public void Start()
{
// Runs the graph. (Asynchronously, if that option has been enabled.)
graphRunner.Run();
// Runs the graph, synchronously, regardless of whether the asychronous option has ben enabled or not.
graphRunner.RunSync();
// Runs the graph, asynchronously, regardless of whether the asychronous option has ben enabled or not.
graphRunner.RunAsync();
}
}