A dialogue system toolkit for Unity, designed to automatically set up in-game dialogue scenes with minimal reliance on Unity's UI.
- About
- Features
- Box styles
- Getting started
- Usage
- Architecture
- Development
- Known issues
- Contributing
- Asset notice
- License
Clapperbox is a Unity dialogue system that takes a CSV screenplay and a cast of characters, and produces a dialogue box prefab that can be dropped into a scene. It handles the timing of text reveal, voice playback, and expression changes, so you can focus on writing the story.
Clapperbox was built with the goal of relying as little as possible on Unity's UI system, so that storytellers can lose as little time as possible on UI setup and focus on their story and characters.
This dialogue system uses structured yet simple CSV files to automatically extract character data and dialogue lines, and create interactive dialogue box prefabs that can be dropped into any scene.
- Premade Samples: 5 premade box styles, each with a sample screenplay and cast, plus a
Templatefor creating your own. - š§© Pluggable speech behaviours ā a
VoiceFactorymaps aVoiceTypeenum to aVoiceStyleclass (Monotone, Duotone, FullWord, Intro). - š Typewriter text effect ā progressive character reveal via coroutine.
- š Expression system ā an expression is the name of a sprite in the character's
Expressions/folder (Happy.pngisHappy,Angry-more.pngisAngry-more), so new expressions need no code changes. Names match regardless of case. - š„ CSV import ā
NAME,EXPRESSION,LINErows (handles quoted commas), imported from theScreenPlayDatainspector or the Create Dialogue Box tool. - 𩹠Missing data check ā before a box is created, Create Dialogue Box lists what each CSV needs but the project lacks, and creates it when you confirm:
- a speaker with no character data gets a
Characters/<Name>/folder copied fromCharacters/0_template, with its expressions and voice already imported - an expression an existing character has no sprite for gets a white placeholder, the size of the character's
Neutralsprite, saved asExpressions/<Expression>.png - a name close to an existing one (
Nugett,Suprised-most) is flagged as a possible typo with a suggestion; Yes fixes it in the CSV, Not a typo creates it as new
- a speaker with no character data gets a
- šļø Clean deletes ā deleting a dialogue box prefab also deletes its screenplay, unless another box still uses it. Character data is never deleted.
- šØ Box styles ā sample dialogue box prefabs plus a
Template, picked from the Create Dialogue Box tool. - š§ Character import ā each character's expressions and voice are imported from a fixed folder layout with one click.
- š Per-speaker audio ā each character gets a voice clip and voice type, played through a singleton
AudioManager. - š¼ļø Speaker theming ā name colour and background tint driven by the character's data.
- Unity
6000.5.6f1or newer - Packages (see
Packages/manifest.json, installed automatically on first open): URP, uGUI (includes TextMesh Pro), 2D, Input System
- Open the project in Unity.
- Open Tools > Clapperbox > Create Dialogue Box, pick a premade sample style, keep the Sample CSV option in the dropdown, and click Create Dialogue Box.
- Drag the new prefab from
Assets/Clapperbox/DialogueBoxes/intoAssets/Scenes/Clapperbox.unityto load it in the scene. - Press Play and click the box to advance lines with
NextLine().
You only write the CSV; Create Dialogue Box handles the rest.
-
Write the screenplay A csv template is provided in
ScreenPlays/csv_templatefor you to copy and edit. Each row in the CSV is a dialogue line with the character'sname,expressionandline.NAME,EXPRESSION,LINE Nugget,Surprised,Look! An abandoned farm! Nima,Neutral,"The gate on my map had a crooked weathervane just like that one."
-
Create the dialogue box
- Navigate to Tools > Clapperbox > Create Dialogue Box.
- Choose your own or a premade style from the drop down.
- Select Custom CSV to add your own screenplay CSV(s): either use the file picker or drag and drop to add one or more CSVs.
- Before creating the box, the tool checks each CSV for missing data (see Missing data check) and handles them automatically if you confirm.
- Click Create Dialogue Box to make your dialogue box prefab.
Each CSV produces:
DialogueBoxes/<CsvName>.prefab: dialogue box prefab to use in your scene.ScreenPlays/<CsvName>_Screenplay.asset: a scriptable object containing the imported screenplay data and its castCharacters/<CharacterName>/<CharacterName>_data.asset: a scriptable object containing the character details, properties and associated assets (if a character already exists, it is reused and not duplicated).
The tool reads the CSV and compares each extracted field with specific paths in the project:
NAME: checks if there is a folder inCharacters/with the same name (case-insensitive) to create or reuse aCharacterDataasset. If it fails, it creates a clone ofCharacters/0_templateand renames it to the character's name.EXPRESSION: checks if the character'sExpressions/folder contains a sprite with the same name (case-insensitive). If it fails, it creates a white placeholder sprite with the same name in the character'sExpressions/folder.LINE: extracts the speaker's line of dialogue and lists it in theScreenPlayDataasset. If a line is empty, it is skipped and a warning is logged.
Typos and misspellings for NAME and EXPRESSION are flagged by the tool.
- Missing expression ā a white placeholder sprite named after the expression is added to the character's
Expressions/folder, so it stands out in play mode until you replace it.
Once a dialogue box prefab is created, you can customize its ScriptableObjects in the inspector:
-
ScreenPlayData: lines can be manually edited from the inspector or re-imported from the CSV with Import CSV (see Authoring your own dialogue).
-
CharacterData: name, colour, voice and voice type can all be edited and/or reimported from the inspector with Import Expressions From Folder and Import Voice From Folder (see What happens under the hood).
The default voice style is set to
Monotoneand can be changed to any of the following voice types:Voice type Text reveal Voice Monotoneone character at a time one blip per character, same pitch Duotoneone character at a time one blip per character, alternating pitch FullWordone word at a time one blip per word Introwhole line at once one blip at the start Animaleseone character at a time one blip per character, pitch varies with character (work in progress)
Creative assets can be reimported from the character's folders with Import Expressions From Folder and Import Voice From Folder.
Currently the user can customize the following data of the dialogue box:
- Screenplay data: write your own CSV screenplay and import it into the box (see Authoring your own dialogue).
- Characters: create your own characters and import their expressions and voice (see What happens under the hood).
- Create a folder under
Assets/Clapperbox/BoxStyles/, e.g.BoxStyles/MyStyle/. - Duplicate a prefab into it ā
Template/Template_DialogueBox.prefabfor a bare start, or one of the sample prefabs to start from a finished look. - Re-skin it ā swap the sprites, fonts, colours and layout. Keep the
DialogueManagerand its four views (DialogueView,NameView,AvatarView,AvatarBgView) assigned. - Open Create Dialogue Box ā the style appears in the style picker. The picker lists every prefab that sits inside a sub-folder of
BoxStyles/and contains aDialogueManager; prefabs placed directly inBoxStyles/are ignored, and several prefabs in one folder show up as a sub-menu. - (Optional) Add a sample screenplay ā name the folder
Sample_<Name>and add a<Name>_sample.csv(in the style folder orScreenPlays/csv/). The tool then offers it as the style's Sample CSV.
Clapperbox separates three concerns:
Data The ScriptableObjects that define:
- The dialogue data: what is said, who says it and the source of that data - the CSV
- The character data: who the speaker is and their properties (their voice and voice style, expression sprites, name and colour).
Logic Everything that is in the Scripts folder, which includes:
- The dialogue manager: manages the dialogue flow and performance for each line
- The audio manager: manages the audio playback for each line
- The voice factory: decides how the data has to be presented by the managers (the timing of the text reveal, the audio playback, etc).
View The MonoBehaviour objects that render the dialogue box:
- The name, the avatar and the background, which render the ScriptableObject data based on the logic from the managers and the voice factory.
- Unity 6 with C#
- Universal Render Pipeline (URP)
17.6.0 - TextMesh Pro for text rendering
- uGUI (
UnityEngine.UI) for the box, avatar and background images - 2D packages (sprite, animation, tilemap, etc.)
- Input System
Assets/
āāā Clapperbox/
ā āāā BoxStyles/ # Sample styles and template prefabs used by the tool to create new dialogue boxes
ā āāā DialogueBoxes/ # Dialogue box prefabs that are created by the tool and used in the scene (one prefab per dialogue CSV)
ā āāā Characters/ # character folders: each folder contains a CharacterData asset, an Expressions/ folder and a Voice/ folder
ā āāā ScreenPlays/ # contains a folder for all your screenplay csvs and the data version created by the importer
ā āāā Fonts/ # fonts used by the sample box styles <- these might be moved to their relevant box style folders in the future
ā āāā Scripts/
ā ā āāā Voice/ # VoiceFactory and voice related classes
ā ā āāā DialogueBox/ # View logic for the dialogue box
ā ā āāā Enums/ # VoiceType, AvatarAnimationStyle
ā ā āāā Generics/ # Reusable base classes
ā ā āāā Managers/ # Manage the flow of the dialogue presentation in a scene (DialogueManager, AudioManager)
ā ā āāā ScriptableObjects/ # Data assets that need to be presented in the scene
ā āāā Editor/ # Tool logic that is accessed from the Unity Editor only.
āāā Scenes/
āāā Settings/
flowchart TD
A[Screenplay CSV] -->|ScreenPlayCsvImporter| B[ScreenPlayData]
C[CharacterData assets] -->|matched by speakerName| B
B --> D[DialogueManager]
D --> E[VoiceFactory]
E --> F[MonotoneStyle]
E --> G[DuotoneStyle]
E --> H[... other VoiceStyles]
D -->|OnPerformance event| I[DialogueView]
D -->|OnPerformance event| J[AudioManager - singleton]
D --> K[NameView]
D --> L[AvatarView]
D --> M[AvatarBgView]
Per line:
DialogueManager.StartLine(i)reads theLine(speaker + text + expression) and looks up the speaker'sCharacterDatain the screenplay's cast.- Views are updated:
NameView(name + colour),AvatarView(expression sprite),DialogueView(line text),AvatarBgView(background tint). VoiceFactory.CreateStyle(speaker.voiceType)returns the matchingVoiceStyle, which splits the text intoVoiceUnitunits (characters to reveal, pitch, tempo, sound length).DialogueManagerplays the units on a coroutine and raisesOnPerformancefor each one:DialogueViewreveals the text andAudioManagerplays the voice clip, cut at the unit's sound length. The style owns the when, so each voice type controls its own rhythm.NextLine()interrupts the current line (OnLineSkippedstops the audio) and starts the next one.
- Factory ā
VoiceFactoryselects aVoiceStylefrom theVoiceTypeenum. - Strategy ā each
VoiceStyleonly describes how a line is spoken;DialogueManagerdoes the timing and playback. - Observer ā
DialogueViewandAudioManagersubscribe toDialogueManagerevents instead of being called directly. - Singleton ā
DialogueManagerandAudioManagershare a genericSingleton<T>base. - MVC-style separation ā models (ScriptableObjects), controllers (managers), views (UI components).
- Editor tooling ā the Create Dialogue Box window (style picker with preview, batch CSV import), a custom
ScreenPlayDatainspector with a CSV field + Import/Clear buttons, and folder-based expression/voice import onCharacterData.
Edit-mode tests live in Assets/Clapperbox/Editor/Tests/. Run them from Window > General > Test Runner > EditMode.
Animaleseis not implemented yet. It can be picked as a character's voice type, butVoiceFactorylogsUnhandled VoiceTypeand the line's text and voice never play (name and avatar still update). Use another voice type for now.- Avatar animation states (
Fixed,Float,Shake,ZoomedinAvatarAnimationStyle) are defined but not wired up, so avatars stay fixed. - Importing from the
ScreenPlayDatainspector skips the missing data check. A speaker with no matchingspeakerNameis left out of the cast; in play mode that line logs an error and the box keeps showing the previous line until the next click. > Use Create Dialogue Box instead, or create the character and re-import.
Bug reports and questions are welcome in GitHub Issues.
The graphics in the sample box styles and sample characters were made with generative AI and quickly edited by hand, so the samples clearly show how the tool works. They are placeholders for demonstration, not finished official art..
