MySys22.DialogueSystem
Document
1.0
Engine
0.5 BETA
Editor
0.5 BETA
Updated
2026-09-28

5. Engine execution cycle

ClassRole
DialoguePathsall positions of the contract; no other file may construct paths
DialogueStreamingAssetsper-platform I/O (direct file or UnityWebRequest)
DialogueProjectLoaderprepares the project and loads the graph
DialogueProjectManifestLoaderreads engine.manifest.json
LanguageManagercurrent language, available languages, saved preference
YamlLineProviderin-memory line database (GetLine(cid, did))
CharacterRegistryCID → displayed name
DialogueVariableCatalogvariable declarations
DialogueGraphIndexgraph index + in-memory graphs (used by jump nodes)
GraphYamlParserYAML ↔ GraphData
DialogueGraphPlayerexecutes the graph: nodes, choices, waits, functions, audio
ActionRegistrydiscovery and instantiation of the actions
DialogueBridge (MonoBehaviour)facade: events, language, variables, quests, position
Dialogue (static)convenient API for the game
DialogueUICanvas / DialogueOverlayUIpresentation (IDialogueView)
DialogueProjectValidatorgraph/line consistency checks

The startup sequence, valid on both desktop and mobile, is the following:

  1. GameSetup/DialogueBridge.Awake starts initialisation (asynchronous on mobile, synchronous on

desktop).

  1. DialogueProjectLoader reads manifest → languages → characters → variables → graph index → graph.
  1. YamlLineProvider loads the lines of the selected language.
  1. The bridge connects the variables (with QuestVariableMirror) and creates the player.
  1. StartDialogue() starts from the startNode node; Update() calls Tick() every frame.

The call to StartDialogue() performed before initialisation has finished is not lost: it is deferred (_startWhenReady).

5.1 DialogueGraphPlayer — states

StateMeaning
Runningis showing a node or advancing
WaitingForChoicewaits for Choose(index)
WaitingForActionwaits for the end of a function (with safety timeout)
stoppeddialogue terminated (End or finished graph)

The following rules apply:

events arrive from the bridge, but it is mandatory if the game drives the player on its own.

ConfigureAwait(false) so as not to block Tick().

in progress.


6. Management of functions and actions

The interface contract is the following:

public interface IAction
{
    void Execute(DialogueActionContext context);
    Task ExecuteAsync(DialogueActionContext context, CancellationToken cancellationToken);
    void Cancel();
}

With regard to automatic discovery: a class decorated with [DialogueAction("NomeAzione")] is found at startup and its name appears in the dropdown of the Function node. MonoBehaviours are rejected with a warning: the actions must be pure classes, since they are instantiated by the engine.

The DialogueActionContext object exposes: ActionId, Node, Graph, Speaker, Language, Parameters (with GetParameter, GetInt, GetFloat, GetBool), Player, Variables, Quests, Completion, Result, plus the commands SetResult(bool), SetNeutral(), Complete().

ConceptBehaviour
Wait for completion on the nodethe dialogue stops until the function closes
ctx.SetResult(true/false)routes the dialogue onto the True/False outputs of the connected Condition nodes
ctx.CompleteNeutral()neutral result: the normal output is taken, the conditions are ignored (with a warning if any exist)
CompletesExternally = truethe function remains open until the game calls Dialogue.Complete(...)
FunctionTimeoutSecondsif nobody closes within the time, the engine closes by itself and proceeds
Exception in the actionlog [305], the function closes in neutral mode, the dialogue continues
On Parallel (Dialogue node)action started in parallel while the line is on screen
On Complete (Dialogue node)action executed when the line has been read

The built-in actions are the following:

IdParametersWhat it does
LogDebugmessagewrites to the Console
Waitsecondswaits N seconds (WaitsForCompletion)
QuestAcceptquestIdaccepts a quest
QuestCompletequestIdcompletes a quest
QuestFailquestIdfails a quest
QuestStepquestId, stepId, donemarks an objective
ReportResultresultcloses the function with true/false
ExternalResult—closes nothing: waits for the game