Skip to content

Auri304/Scriptable-Dialogue-Toolkit-for-Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scriptable Dialogue Toolkit for Unity

A third-party Unity package for building data-driven branching dialogue with ScriptableObject assets, conditional choices, actions, validation, runtime presenters, and save-ready state.

Scriptable Dialogue Toolkit icon

Dialogue toolkit demo

Features

  • ScriptableObject-based dialogue assets for authoring conversations in Unity.
  • Speakers, dialogue nodes, lines, and branching player choices.
  • Conditional choices that can appear or hide based on dialogue state.
  • Dialogue actions for setting variables or raising event IDs to game systems.
  • Built-in validation for duplicate ids, missing links, empty text, unknown speakers, ambiguous flow, and unreachable nodes.
  • UGUI/TextMeshPro presenter with speaker name, portrait, typewriter text, continue button, optional line audio, and generated choice buttons.
  • Sample two-speaker presenter for left/right portrait layouts.
  • Save/resume snapshots for dialogue progress and variables.
  • Extensible condition and action classes for custom project behavior.
  • Editor tooling for validation, sample asset creation, and managed-reference dropdowns.
  • EditMode tests for core runtime behavior.

Known Limitations

  • No visual node graph yet.
  • No built-in localization table integration yet.
  • No Timeline or Cinemachine integration yet.
  • Sample voice/audio support is intentionally simple and presenter-driven.
  • The included UI presenters are examples, not a full visual novel framework.

Installation

Install through Unity Package Manager:

  1. Open Window > Package Manager.
  2. Click +.
  3. Choose Add package from git URL....
  4. Enter:
https://github.com/Auri304/unity-dialogue-system.git

You can also clone the repository and add it as a local package by selecting the package's package.json.

Quick Start

  1. Create a sample asset from Tools > Unity Dialogue System > Create Sample Dialogue Asset.
  2. Add DialoguePlayerUI to a scene object.
  3. Assign a root panel, speaker text, line text, portrait image, continue button, choice root, and DialogueChoiceButton prefab.
  4. Assign the sample DialogueAsset.
  5. Enable Play On Start, or call Play(dialogueAsset) from another script.
  6. Select the dialogue asset and press Validate Dialogue in the Inspector.

Demo Sample

This package includes a complete sample scene in:

Samples~/DialogueDemo

It contains:

  • DemoScene/DialogueDemo.unity
  • demo art, prefabs, audio, and dialogue data
  • DialogueDemoEventReceiver
  • DialogueDemoVariableDebugView
  • TwoSpeakerDialoguePlayerUI

The sample demonstrates typewriter text, speaker portraits, branching choices, event reactions, and optional line audio.

Dialogue choices in the demo scene

Dialogue demo line presentation

Use Cases And Customization

Use the toolkit when you need:

  • branching NPC conversations
  • tutorial dialogue
  • story scenes with conditional choices
  • dialogue-driven game events
  • saveable conversation progress
  • custom dialogue UI connected to reusable runtime logic

The runtime is presentation-agnostic. DialogueRunner controls dialogue flow and raises events such as line presented, choices presented, and dialogue ended. UI scripts decide how those events are shown.

You can use:

  • DialoguePlayerUI for a simple generic UGUI/TextMeshPro dialogue panel.
  • TwoSpeakerDialoguePlayerUI from the sample for a left/right speaker layout.
  • A custom presenter that subscribes to DialogueRunner events and displays the dialogue as subtitles, floating speech bubbles, RPG dialogue boxes, or any other game-specific UI.

Dialogue event reaction demo

Architecture

The toolkit is split into layers:

  • Authoring Data: DialogueAsset, speakers, nodes, lines, choices, conditions, and actions.
  • Runtime Core: DialogueRunner, dialogue context, variables, actions, conditions, and snapshots.
  • Presentation: UI scripts that listen to runner events and display dialogue.
  • Editor Tooling: validation buttons, menu commands, and managed-reference drawers.
  • Samples: demo scene, sample presenter, and event-reaction scripts.
  • Tests: EditMode tests for runtime traversal, branching, actions, conditions, snapshots, and validation.

The runner does not know about UI, scenes, quests, inventory, characters, or game-specific systems. It only knows dialogue flow. Game systems connect through variables, raised event IDs, and presenter scripts.

Editor Tools

  • DialogueAssetEditor: Adds a validation section to each dialogue asset inspector.
  • Validate Selected Dialogue Assets: Menu command under Tools > Unity Dialogue System.
  • Create Sample Dialogue Asset: Menu command that generates a small branching sample conversation.
  • ManagedReferenceChoiceDrawer: Dropdown support for selecting concrete condition/action types in managed-reference fields.

Dialogue asset authoring in the Inspector

Dialogue choices and actions in the Inspector

Dialogue validation result

Tests

EditMode tests live under:

Tests/Editor

They cover core runtime behavior, including traversal, branching, condition filtering, action execution, save/resume snapshots, and validation errors.

To run them in Unity:

  1. Open Window > General > Test Runner.
  2. Select the EditMode tab.
  3. Click Refresh if the tests are not visible.
  4. Select the dialogue system test assembly.
  5. Click Run Selected, or use Run All to run the full EditMode suite.

Future Improvements

  • Visual node graph editor.
  • Localization support.
  • Dialogue history/log.
  • Timeline/Cinemachine integration sample.
  • Richer voice-over tooling.
  • More sample presenters for different UI styles.

About

A reusable Unity dialogue system with branching choices, conditions, actions, validation, editor tooling, and save-ready runtime state.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages