Loading and Executing in Unity
Loading Scripts
Interpreting and Executing
Integrating with Game Systems
// Assigned in the Inspector
public DSLScriptAsset dslAsset;
// Called from a MonoBehaviour
async void Start()
{
var interpreter = new DSLInterpreter();
// Parse the script text from the Asset into flows
var flows = DSLFlowGenerator.GenerateFlows(dslAsset.scriptText);
interpreter.SetFlows(flows);
// Execute a specific flow (e.g. @Init)
if (flows.TryGetValue("@Init", out var initFlow))
{
await interpreter.ExecuteFlow(initFlow);
}
}
Last updated