Setup the UI
Create a basic dialogue UI with the following structure — the exact layout and styling is up to you:- A speaker name text element (TextMeshPro)
- A dialogue text element (TextMeshPro)
- A way to trigger the next line (Button, keypress, etc.)
Writing the Dialogue
Create a folder and name itResources, this is where dialogue files live.
Now we have to create the folders that would hold the dialogue files – Parley’s file path resolution works as follows: Resources/{Language}/{FolderName}/{LanuguageCode}.{Name} e.g. Resources/English/Hello/en.Parley.yaml
Create the file following the structure above — the Resources folder can live anywhere inside your project’s Assets directory.
en.Parley.yaml
A node with no
NextNode field, or a null one, is treated as the end of the dialogue.Setting up the Script
With the file ready, let’s get into the script. Create a C# script and name it something likeHelloParley.cs and let’s get to writing it.
HelloParley.cs
Wiring things up
Back in the Unity editor, add theHelloParley.cs script to a GameObject in your scene, and set the SpeakerNameText and DialogueText variable fields to the text fields you made in the UI section.