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

10. Position and save

10.1 Static facade

MemberDescription
Dialogue.Positioncurrent DialoguePosition (or null)
Dialogue.SavePosition()string ready to be saved
Dialogue.RestorePosition(snapshot)rebuilds a DialoguePosition from a string
Dialogue.SetFunctionProgress(string)progress of a long function (e.g. "3/7")
Dialogue.OnPositionChangedevent Action<DialoguePosition>

Syntax

Dialogue.Position
Dialogue.SavePosition()
Dialogue.RestorePosition(snapshot)
Dialogue.SetFunctionProgress(string)
Dialogue.OnPositionChanged

Parameters

ParameterDescription
snapshotposition state string
progress valueprogress of a long function, for example "3/7"

Return value

Dialogue.SavePosition() returns a string ready to be saved; Dialogue.RestorePosition(snapshot) returns a DialoguePosition rebuilt from the string.

Notes

Dialogue.Position exposes the current DialoguePosition or null. Dialogue.OnPositionChanged is an event of type Action<DialoguePosition>.

Example

Dialogue.OnPositionChanged += pos =>
{
    Debug.Log($"{pos.GraphId} / {pos.NodeId} / line {pos.LineIndex} of {pos.LineCount}");
    if (pos.IsInsideFunction)
        Debug.Log($"inside function {pos.FunctionActionId}: {pos.FunctionProgress}");
};

string snapshot = Dialogue.SavePosition();      // e.g. PlayerPrefs.SetString("dlg", snapshot)

DialoguePosition pos = Dialogue.RestorePosition(snapshot);
Debug.Log($"restorable at {pos.GraphId}:{pos.NodeId}");

10.2 Fields of DialoguePosition

FieldMeaning
GraphIdcurrent graph
NodeId, NodeTypecurrent node
Speaker, Did, LineIndex, LineCountcurrent line and position in the line
WaitingForChoice, WaitingForActionwaits
FunctionActionId, FunctionProgressfunction in progress and its progress
Language, Runninglanguage and dialogue state
IsInsideFunctionshortcut: `WaitingForActionFunctionActionId != null`

10.3 Restore model

The engine does not write to disk: the position is captured by the engine and saved by the application code. Restore is designed to be driven by the game: the variables, the quests and the scene are brought back to the desired state and the dialogue restarts from the saved node, maintaining full control over saves, checkpoints and reopening of the scenes.

11. Diagnostics

11.1 Logging

MemberDescription
DialogueLogger.Enabledswitches the logs on/off
DialogueLogger.Prefix[MySys22.DialogueEngine]
DialogueLogger.Log(...) / LogWarning(...) / LogError(...)coherent logs
DialogueLogger.LogError(code, description, detail = null)log with code [3xx]
bridge.Validate()Report with Errors, Warnings, Infos, NodesChecked, LinesChecked, ToText()

Syntax

DialogueLogger.Enabled
DialogueLogger.Prefix
DialogueLogger.Log(...)
DialogueLogger.LogWarning(...)
DialogueLogger.LogError(...)
DialogueLogger.LogError(code, description, detail = null)
bridge.Validate()

Parameters

ParameterDescription
codenumeric code of the message, in the format [3xx]
descriptiondescription of the message
detailadditional detail; the default value is null

Notes

DialogueLogger.Prefix corresponds to [MySys22.DialogueEngine]. bridge.Validate() returns a Report with the Errors, Warnings, Infos collections, the NodesChecked, LinesChecked counters and the ToText() method.

11.2 Message filter

The prefix of the messages is MySys22; on device the corresponding filter is adb logcat -s Unity | grep MySys22.