# 1. Ink vs the Dialogue System Part of [[Ink Narrative Integration]]. Next: [[2. Installing Ink for Unity 2.0]]. > [!warning] Code not compiled in Unity > Type-checked against Unity 6000.5.8f1 assemblies and Ink Unity Integration 2.0.0 (see the hub). Not compiled or run in the Editor. You already teach branching dialogue with the class [[0.Dialogue System]]. Do not throw it out. This part draws a hard line between the two tools so a student (or a future you) can pick one per conversation, or let Ink drive the same presenter the Dialogue System already uses. ## 1.1 What the class Dialogue System is good at The notes under [[0.Dialogue System]] describe a Unity-native tree: - Author in the scene as a **GameObject hierarchy** ([[3.Dialogue System gameObject Nodes]]), or as a **JSON file** ([[4.Dialogue System JSON file]]). - Inspect and edit GameObject trees in the **Dialogue Tree Editor** ([[5.Dialogue System Dialogue Tree Editor]], [[7.Dialogue Visual Node Editor]]). - Run them through `DialogueManager` / `NPCConversationManager`, with a typewriter and per-NPC memory. That shape is ideal when: - The conversation is **short** and **tied to one scene object** (an NPC, a terminal, a door). - Students should see dialogue as **components on GameObjects**, in the same week they learn the Inspector. - You want to open the tree next to the NPC without leaving Unity, and without installing a third-party compiler. - The branching is a handful of nodes, not a novella. [[Conversation Engine Design for Unity 6]] pushes the same idea further: a **rules** object that yields lines and choices, and a **presenter** that does not own those rules. Keep that split no matter which authoring format you pick. The 360 notes ([[Dialogue and Spaces 360 — Unity 6000.6.5f1 (Universal 3D URP)]], [[Setup guide — Dialogue and Spaces 360]]) cover the case where the "line" is a place rather than a subtitle. [[Authoring Custom UPM Packages]] and [[3. Converting the Dialogue System into a Package]] package that class system for install into student projects. Ink does not replace that package; it is a second authoring front end you can introduce later. ## 1.2 What Ink is good at Ink is a **text language** designed at inkle for games like *80 Days* and *Heaven's Vault*. A writer works in `.ink` files (often in the free **Inky** editor, or in any text editor) and compiles them to a JSON story. In integration **2.0.0**, Unity's ScriptedImporter does that compile step for you; the imported asset is an `InkFile`, and game code runs `Ink.Runtime.Story`. That shape is ideal when: - The conversation is **long**, heavily branched, or revisited, and a node graph becomes unreadable. - You want **variables, lists, gathers, and conditional text** in the story file itself, so the writer can express "if the player already has the permit" without asking a programmer to add a node type. - Several conversations share **INCLUDE**d snippets (items, character voice, repeating barks). - You need a **saveable VM state** (`story.state.ToJson`) that captures read counts, current knot, and variables in one blob. - A writer who is not a Unity user should be able to iterate in text, then drop the file into the project. Ink is a poor fit when the "dialogue" is three lines on a sign, or when the whole point of the exercise is "make a node editor." Use the class system for those weeks. ## 1.3 Node tree vs bytecode VM | | Class Dialogue System | Ink 2.0 in Unity | |---|---|---| | Source of truth | GameObject tree or a JSON file you authored | `.ink` text, compiled on import to `InkFile.storyJson` | | Runtime object | Your `DialogueManager` walks nodes | `Ink.Runtime.Story` interprets compiled JSON | | Branching | Explicit node links | Diverts, choices, gathers, and conditions in text | | State | Whatever you stored (`NPCMemory`, custom fields) | `variablesState` plus visit counts, plus the callstack, all inside `StoryState` | | Editor | In-Unity tree editor | Ink Player window, the `InkFile` inspector, and (optionally) Inky on the desktop | | Pattern ([[Game Programming Patterns (Review)]]) | Interpreter you wrote; nodes are data | **Bytecode**: the JSON is the program, `Story` is the VM | The Bytecode chapter in Nystrom is the right mental model. You do not reimplement Ink's evaluator. You **feed it input** (choice index, sometimes a path or a function call) and **read its output** (text, tags, choices, variable changes). ## 1.4 One presenter, two sources [[Conversation Engine Design for Unity 6]] already argues that the view should not know how a line was authored. The UI Toolkit presenter in [[4. Story Loop and UI Toolkit Presenter]] speaks a small language: - Show this **line** (text, speaker, optional tags). - Show these **choices**, or a **continue** affordance. - Tell the runner the player **advanced** or **picked index N**. The class Dialogue System can emit the same events. If you later want one subtitle panel for both, put that panel on a shared view and keep two thin runners. Do not let `Ink.Runtime.Story` leak into UXML, and do not let `DialogueNodeAuthoring` leak into the Ink runner. A Timeline shot can also display Ink lines: [[3. Subtitle and Dialogue Track]] already draws UI Toolkit subtitles from a custom track. Drive that view from the runner's "line" event when you need a conversation inside a cutscene, and still keep the skip rules from [[Timeline Advanced]] and Level 17 of [[Level Up! (Review)]]. ## 1.5 What this series builds A small **Harbor Briefing** conversation: a harbormaster who will stamp a permit, offer a favour, and sometimes hand over a lantern. The story file owns the branching and the `trust` / `has_permit` variables. C# owns the UI, the inventory grant, the quest stage, and the save blob. Part 3 writes the `.ink`; parts 4–6 write the Unity side; part 7 tests the compiled story without entering Play Mode. If a student only needs a three-node shopkeeper, send them back to [[0.Dialogue System]] and skip the rest of this series. Next: [[2. Installing Ink for Unity 2.0]].