Skip to main content

Setting up the UI

Continuing off of the UI from the last example, you can now make a button and save it as a prefab and delete it from the scene, we’ll instantiate this later to use it for making the choices!

Writing the Dialogue

Create a folder at Resources/English/Choice/ Right click inside the folder to create a ParleyGraph from Create/Parley/Graph and name it en.Example. After double clicking the graph to open it, you will be greeted with the the graph view where you’ll be doing the visual design of your dialogues. Parley Graph View From the Context Menu, create a StartNode. Drag from the out port on the StartNode and select DialogueNode. Create a few dialogue nodes and fill their Speaker and Text fields with whatever you want, you can use the example below as reference or copy the same structure and text.
Example Parley Graph

Setting up the Script

And with that, we’re ready to get into the script side of things! Create the following C# script:
ChoiceExample.cs

Wiring things up

Back in the Unity editor, add the ChoiceExample.cs script to a GameObject in your scene, and set the Button Prfab from the UI section. Script Variable Fields

Testing

Hit play. Left click in the Game View to advance through the dialogue — you should see the speaker and text update with each click, make your choices by clicking on the when they get created, and the dialogue ends cleanly on the last node.