Skip to content

TryllWorkflowAsset

Type: ScriptableObject
Namespace: Tryll.Client
Source: Runtime/TryllWorkflowAsset.cs

ScriptableObject that stores a TryllGraphDescription as a project asset. Assign it to a TryllAgentComponent to define which workflow graph the agent runs. Because it is a regular Unity asset, it is serialized, version-controlled, and reusable across multiple GameObjects.


Creating an asset

In the Project window: right-click → Create → Tryll → Workflow Asset.

The asset opens in the Inspector where you can configure Graph nodes and routes, or populate them programmatically via TryllGraphBuilder.


Public API

public sealed class TryllWorkflowAsset : ScriptableObject
{
    public TryllGraphDescription Graph;
    public List<TryllVariableDecl> Variables;
}

Graph is the complete workflow graph description. It is serialized by Unity's standard serialization and editable in the Inspector.

Variables declares the agent's Agent Variables store — name, type, and initial value, passed to CreateAgent. A TryllAgentComponent.VariableOverrides entry may override a declared variable's initial value per-instance without changing this asset (Material-Instance pattern).


Programmatic alternative

If you do not need a persistent asset, build a TryllGraphDescription in C# and create the agent directly from it — no component required:

var graph = new TryllGraphBuilder()
    .AddGenerate("gen", new TryllGenerateParams
    {
        // DefaultExit is "" (END) by default
    })
    .SetStartNode("gen")
    .SetDefaultModelName("my-model")
    .Build();

var (agent, error) = await TryllClient.Instance.RequestCreateAgentAsync(graph);

Inline graphs are temporary

TryllAgentComponent.InlineGraphDescription — assigning a code-built graph to the component instead of using a Workflow Asset — is a temporary feature and will be removed in a future release. When you use TryllAgentComponent, author the graph as a Workflow Asset and assign it to the component's Workflow Asset field.


See also