Branching Dialogue System for Unity

An open-source node based branching dialogue system created by me for Unity, which can visualise the dialogues in graphs.

warning -- the graph's current capabilities are limited. It is mostly for visualisation of already created dialogue nodes. Text and connections between existing nodes can be edited and saved. However, new nodes cannot be created in the graph, yet.


This website is a tutorial on how you can use this system in Unity.
Let's get started.

Getting started

The first step is to download the free package from Github or Unity Asset Store. Links down below.

Inside the folder DialogueSystemAsset in all you need, including a sample scene.

Warning -- I have only tested this asset on Unity Version 2019.3


Structure

This section helps you understand the structure of the system.


implementation

This section teaches you how to use the dialogue system in Unity for your game

Firstly, there is a DialogueManager that updates the UI (such as text bubbles and options buttons) as the dialogue progresses.

So many empty fields to fill ...
I know it looks intimidating, but most of it is just linking the UI.
I suggest you take a look at the sample scene if the naming isn't intuitive.

In case you want a Single Dialogue Box System, you can just link the NPC and Player UI elements to the same UI.


To start a dialogue, you just need a reference to the DialogueManager in the scene and call a StartDialogue() method and pass in the dialogue as parameter.


Now you may be wondering how to animate the dialogue boxes and add consequences if player chooses a certain option. To do that, you need to understand another SciptableObject in this system -- GameEvent.

GameEvent is basically an expansion of UnityEvent. Once a GameEvent is activiated(gameEvent.Raise()), all the UnityEvent that listens to the GameEvent will be called.



Example 1 -- The following component listens to the ConversationStart GameEvent, and once the event is raised, the animator of the canvas will set the aimation trigger to show the dialogue boxes.

Example 2 -- When the highlighed option is chosen, the ChloeAngry GameEvent is raised, and since a listener listens to this event, the response is triggered.


dialogue graph

This section teaches you how to visualise your dialogues in graphs and what and how you can edit in the graph.


( Made with Carrd )