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

4. Dialogue class reference

4.1 Bridge, view and player

MemberDescription
Dialogue.Bridgethe active DialogueBridge (auto-resolved)
Dialogue.SetBridge(DialogueBridge)sets the bridge explicitly
Dialogue.Playerthe DialogueGraphPlayer
Dialogue.View / SetView(IDialogueView)the presentation view
Dialogue.IsFunctionRunninga function is awaiting a result

Syntax

Dialogue.SetBridge(DialogueBridge)

Parameters

ParameterDescription
instance of DialogueBridgethe bridge to set as active

Notes

Dialogue.Bridge resolves the active bridge automatically. Dialogue.View and SetView(IDialogueView) expose and set the presentation view. Dialogue.IsFunctionRunning indicates the presence of a function awaiting a result.

4.2 Panel and text

MemberDescription
ShowPanel() / HidePanel()shows/hides the dialogue panel
IsPanelVisiblepanel state
ShowText(speaker, text) / ShowText(text)writes a line
SetSpeaker(string) / SetText(string)updates only one part
HideText() / HideChoices()hides text or choices

Syntax

ShowPanel()
HidePanel()
ShowText(speaker, text)
ShowText(text)
SetSpeaker(string)
SetText(string)
HideText()
HideChoices()

Notes

IsPanelVisible indicates the panel state. The forms ShowText(speaker, text) and ShowText(text) write a complete or partial line; SetSpeaker(string) and SetText(string) update a single part; HideText() and HideChoices() hide text and choices respectively.

4.3 Functions

MemberDescription
Complete(bool result) / Complete()closes the function with true/false
CompleteNeutral()closes the function without a result (conditions are ignored)
WaitForCompletion(DialogueActionContext)Task that completes when the function closes
RunAction(actionId, parameters = null)executes an action outside the graph
HasAction(id) / Actionsregistered actions

Syntax

Complete(bool result)
Complete()
CompleteNeutral()
WaitForCompletion(DialogueActionContext)
RunAction(actionId, parameters = null)
HasAction(id)
Actions

Parameters

ParameterDescription
resultboolean outcome with which the function is closed
DialogueActionContextcontext of the function whose closure is awaited
actionIdidentifier of the action to execute
parametersparameter dictionary; the default value is null
ididentifier of the registered action

Return value

WaitForCompletion(DialogueActionContext) returns a Task that completes when the function closes. HasAction(id) verifies the presence of the registered action; Actions exposes the registered actions.

Example

[DialogueAction("AskPassword")]
public sealed class AskPasswordAction : IAction
{
    public void Execute(DialogueActionContext ctx)
    {
        UIManager.OpenPasswordPanel(success =>
        {
            ctx.SetResult(success);
            ctx.Complete();
        });
    }

    public Task ExecuteAsync(DialogueActionContext ctx, CancellationToken ct) => Task.CompletedTask;
    public void Cancel() => UIManager.ClosePasswordPanel();
}

4.4 Audio

MemberDescription
PlayAudio(track, loop = false) / StopAudio()ambience track
PlayVoice(speakerCid, did) / StopVoice()voice of a line
StopAllAudio()stops everything
RegisterAudioClip(track, clip)registers a clip at runtime (e.g. from Addressables)
IsAudioPlaying / CurrentAudioTrackstate
VoiceEnabledenables/disables voices

Syntax

PlayAudio(track, loop = false)
StopAudio()
PlayVoice(speakerCid, did)
StopVoice()
StopAllAudio()
RegisterAudioClip(track, clip)
IsAudioPlaying
CurrentAudioTrack
VoiceEnabled

Parameters

ParameterDescription
trackidentifier of the ambience track
loopindicates the repetition of the track; the default value is false
speakerCididentifier of the speaker for the voice
dididentifier of the line
clipaudio clip registered at runtime

Notes

RegisterAudioClip(track, clip) registers a clip at runtime, for example originating from Addressables. IsAudioPlaying and CurrentAudioTrack indicate the playback state; VoiceEnabled enables or disables the voices.

5. DialogueBridge class reference

5.1 Events

EventPayload
OnLine(string speaker, string text)
OnChoicesList<ChoiceOption>
OnDialogueEnd—
OnWaitingForActionChangedbool waiting
OnGraphJumped(string graph, string node)
OnVariableChanged(string name, DialogueValue value)
OnQuestChanged(string questId, QuestState state)
OnPositionChangedDialoguePosition

ChoiceOption exposes Text, Did, Next, Index, Condition, Enabled/Visible (according to the option condition).

5.2 Dialogue control

MemberDescription
Initialize()initializes (synchronous: desktop)
InitializeAsync()initializes (asynchronous: mandatory on mobile)
IsInitializedstate
StartDialogue()starts from the start node; if the init is in progress the start is deferred
Continue()advances to the next line
Choose(int index)selects an option
StopDialogue()stops and cancels the actions in progress
Restart()restarts from the beginning
Reload()reloads the project (asynchronous on mobile)
IsDialogueActive, IsWaitingForAction, PendingActionIdstate
SetGraphPath(string)changes graph before the start
Project, Graph, GraphPath, Manifestloaded data
Validate()DialogueProjectValidator.Report

Syntax

Initialize()
InitializeAsync()
StartDialogue()
Continue()
Choose(int index)
StopDialogue()
Restart()
Reload()
SetGraphPath(string)
Validate()

Parameters

ParameterDescription
indexindex of the option to select in Choose(int index)
pathpath of the graph set by SetGraphPath(string)

Return value

Validate() returns a DialogueProjectValidator.Report.

Notes

The example of initialization and manual start of the bridge is reported in section 12.2.

5.3 Language

MemberDescription
CurrentLanguage / CurrentLanguageLabelcurrent language (code and label)
AvailableLanguagesdistributed list
SetLanguage(lang, restartIfActive = true)changes language
CycleLanguage(restartIfActive = true)advances to the next one
RefreshLanguages()re-reads the languages from the manifest

Syntax

SetLanguage(lang, restartIfActive = true)
CycleLanguage(restartIfActive = true)
RefreshLanguages()

Parameters

ParameterDescription
langcode of the language to set
restartIfActiveindicates the restart of the dialogue if it is active; the default value is true

Notes

CurrentLanguage and CurrentLanguageLabel expose the code and the label of the current language; AvailableLanguages exposes the distributed list. RefreshLanguages() re-reads the languages from the manifest.

5.4 Savable state

string vars   = bridge.SaveVariableState();      // variables only
bridge.LoadVariableState(vars);

string state  = bridge.SaveNarrativeState();     // variables + quests

SaveVariableState() serializes the variables only; LoadVariableState(vars) restores them. SaveNarrativeState() serializes variables and quests.