Table of Contents

Class DialogManager

Manages dialog playback and conversation flow. Singleton pattern ensures only one DialogManager exists in the scene.

public class DialogManager : MonoSingleton<DialogManager>
Inheritance
DialogManager
Inherited Members
Extension Methods

Fields

playableDirector

public PlayableDirector playableDirector

Field Value

PlayableDirector

Properties

AudioSource

The audio source used for dialog audio playback.

public AudioSource AudioSource { get; }

Property Value

AudioSource

CurrentConversation

The currently active conversation.

public Conversation CurrentConversation { get; }

Property Value

Conversation

CurrentDialog

The currently playing dialog.

public DialogObject CurrentDialog { get; }

Property Value

DialogObject

HasActiveConversation

Whether a conversation is active.

public bool HasActiveConversation { get; }

Property Value

bool

IsPlaying

Whether a dialog is currently playing.

public bool IsPlaying { get; }

Property Value

bool

OnConversationEnded

Unity event accessor for conversation ended.

public ConversationEvent OnConversationEnded { get; }

Property Value

ConversationEvent

OnConversationStarted

Unity event accessor for conversation started.

public ConversationEvent OnConversationStarted { get; }

Property Value

ConversationEvent

OnDialogFinished

Unity event accessor for dialog finished.

public DialogEvent OnDialogFinished { get; }

Property Value

DialogEvent

OnDialogStarted

Unity event accessor for dialog started.

public DialogEvent OnDialogStarted { get; }

Property Value

DialogEvent

Methods

EndConversation(bool)

Ends the current conversation.

public void EndConversation(bool wasCompleted = true)

Parameters

wasCompleted bool

Whether the conversation was completed naturally.

GetConversationProgress()

Gets the progress of the current conversation (0-1).

public float GetConversationProgress()

Returns

float

GetDialogAudioProgress()

Gets the current dialog's audio playback progress (0-1).

public float GetDialogAudioProgress()

Returns

float

GetRemainingDialogsCount()

Gets the remaining dialogs count in the current conversation.

public int GetRemainingDialogsCount()

Returns

int

HandleActionAndRewind(float, IDialogActionRequire, double)

public void HandleActionAndRewind(float delay, IDialogActionRequire dialogActionRequire, double audioLength)

Parameters

delay float
dialogActionRequire IDialogActionRequire
audioLength double

HasMoreDialogs()

Checks if the current conversation has more dialogs.

public bool HasMoreDialogs()

Returns

bool

JumpToConversation(Conversation, int)

Skips to a specific conversation and optionally starts from a specific dialog index.

public void JumpToConversation(Conversation conversation, int startDialogIndex = 0)

Parameters

conversation Conversation
startDialogIndex int

OnDestroy()

Unity lifecycle: clears the static instance reference when this object is destroyed.

protected override void OnDestroy()

PauseDialog()

Pauses the current dialog audio.

public void PauseDialog()

PlayDialog(DialogObject)

Plays a specific dialog.

public void PlayDialog(DialogObject dialog)

Parameters

dialog DialogObject

The dialog to play.

PlayNextDialog()

Plays the next dialog in the current conversation.

public bool PlayNextDialog()

Returns

bool

True if a dialog was played, false if no more dialogs.

ResumeDialog()

Resumes the paused dialog audio.

public void ResumeDialog()

SetAudioSource(AudioSource)

Sets the audio source to use for dialog playback.

public void SetAudioSource(AudioSource source)

Parameters

source AudioSource

SkipCurrentDialog(bool)

Skips the current dialog and optionally plays the next one.

public void SkipCurrentDialog(bool playNext = true)

Parameters

playNext bool

Whether to automatically play the next dialog.

StartConversation(Conversation, bool)

Starts a new conversation.

public void StartConversation(Conversation conversation, bool resetConversation = true)

Parameters

conversation Conversation

The conversation to start.

resetConversation bool

Whether to reset the conversation to the beginning.

StopCurrentDialog()

Stops the current dialog without firing finish events.

public void StopCurrentDialog()