Sync vs Async
Sync and async run the same graph, with the same nodes in the same dependency order. What changes is who waits. Sync finishes everything before returning. Async lets supported nodes hand control back to Unity between steps, so the editor or game keeps running.
The difference at a glance
| Sync | Async | |
|---|---|---|
| Graph and node order | Same | Same |
| Result ready | When the call returns | When the awaited task completes |
| Editor / game while running | Waits | Keeps updating |
| Parallel sibling nodes | No | No, async doesn't parallelize nodes |
| Best for | Small graphs, one-off regeneration, tests | Large graphs, previews while editing, regeneration during play |
In the editor
Graph previews use the Sync / Async choice in the graph toolbar's Advanced menu. Async previews are cancellable. Edit a value mid-run and the old preview is dropped while a fresh one starts. The Scene view keeps the last finished result until the new one is ready. See Preview Stage and inspection.
On the Procedural Graph Executor
Execute as Async on the Procedural Graph Executor component yields supported work so Unity stays responsive during generation. It doesn't move the whole graph to a background thread. Creating GameObjects and other Unity API calls still happen on the Unity thread.
From C#
using CuriousTrove.OctoShaper;
using UnityEngine;
public sealed class Regenerate : MonoBehaviour
{
[SerializeField] private ProceduralGraphExecutor executor;
public void RunNow() => executor.Evaluate(); // synchronous
public async void RunSmoothly()
{
await executor.EvaluateAsync(); // asynchronous
Debug.Log($"Generated {executor.Output?.Count} rows");
}
}
GenerateSync() and GenerateAsync() are equivalent older names that still work. Don't start overlapping evaluations on the same component, and never block on the task with .Wait() or .Result on Unity's thread.
For data-only execution without a component, see Runtime generation.
ValueTask node methods (1.2)
Heavy geometry and distribution node methods now return ValueTask or ValueTask<T>. This only matters if you call node methods directly from C#: await each call. Graphs themselves still run synchronously when you ask them to, and custom nodes can return ValueTask too. See Creating custom nodes.
After upgrading, run Tools > OctoShaper > Generate Graph Code so generated executors pick up the new signatures.
Frequently asked questions
Does async make my graph run on a background thread?
Is async faster than sync?
Can I still run a graph synchronously in 1.2?
Evaluate() or the Sync option. Only direct C# calls to heavy node methods must now await their ValueTask.