A simple dynamic system to build dialogs in a Unity game using an external JSON file
This system is built with MVC (Models including DialogTree, DialogTreeNode, and DialogOption) design pattern with simple usage for game designers, using JSON to deserialize the dialog text into the tree.
Users can replay the dialog, but only choose the choices made in the first dialog-run.
The dialog system also checks if users can get stuck in your dialog (if your dialog has loops) and warns you about it.
- Edit the dialog prefab however you like.
You can edit the dialog background image, text fonts, colors, position/size of elements, and button UI.
- Attach the DialogOpener component to your scene script
- Attach your updated prefab, the name of the speaking NPC, and the name of the JSON file that contains your dialog. make sure the file is in the Resources folder
- Whenever you wish to start the dialog, just call for the DialogOpener.startDialog() function.
An example of the JSON structure required is attached here. Which contain a list of text nodes along with its options (a max of 3).
-To add the ability to structure the dialog via inspector.
-To increase option numbers (adding left and right buttons to see all options).


