Graph Runner
Inherits from Singleton
Description
To run a graph during runtime, this GraphRunner singleton can be used. This singleton contains two methods, one to run the graph that is currently loaded in the TerraTiler2D editor window, and one to run a Graph object without showing it in the TerraTiler2D editor window. These methods will return a Graph Output object containing all of the processed properties of your graph, which you can then use for whatever you wish.
Methods
Name Return type Description
GetInstance() GraphRunner Get the singleton instance.
RunGraphDuringRuntime(GraphData graphData, Action<GraphFinishedEvent> listener, GraphSeed graphSeed = GraphSeed.Random) void Run a graph based on a GraphData object, which contains serialized data on properties, nodes, edges, and port values.
This version of the RunGraph method will not visually show the graph, and is usable during runtime.
After the graph is finished, the ‘listener’ will be invoked, and the GraphOutput that was produced will be passed into the listener method.

An example of a listener method:
handleGraphFinished(GraphFinishedEvent evt) {
   World generatedWorld = evt.generatedOutput.GetProperty<World>("New World");
   WorldBuilder.GetInstance().PlaceTiles(generatedWorld, transform);
}

Which would be invoked using:
GraphRunner.GetInstance().RunGraphDuringRuntime(myGraphData, handleGraphFinished);
RunGraph(GraphView graphView, Action<GraphFinishedEvent> listener = null, GraphSeed graphSeed = GraphSeed.Random) void Run the graph that is currently loaded in the TerraTiler2D editor window (also known as a GraphView).
This method is used by TerraTiler2D to execute your graphs in the Unity editor, but is also available for users if they wish to make changes to the TerraTiler2D editor.
After the graph is finished, the ‘listener’ will be invoked, and the GraphOutput that was produced will be passed into the listener method.

An example of a listener method:
handleGraphFinished(GraphFinishedEvent evt) {
   World generatedWorld = evt.generatedOutput.GetProperty<World>("New World");
   WorldBuilder.GetInstance().PlaceTiles(generatedWorld, transform);
}

Which would be invoked using:
GraphRunner.GetInstance().RunGraph(myGraphView, handleGraphFinished);
StopGraph(GraphView graphView = null) void Tries to stop the graph that is currently running in the target GraphView.
GetPreviousSeed() int Gets the seed that was used for the previous graph execution.