OpenDialogue for Unity Documentation
Created By RDX Interactive
Created By RDX Interactive 0
About 1
Quickstart 1
Understanding the choices system 3
1
About
OpenDialogue for Unity is a powerful tool you can use to add dialogue to your games. While it
may seem daunting at first, you can use this documentation to learn how to use this unity asset.
OpenDialogue for Unity was created to solve the problem of the lack of free alternative to
expensive assets to create visual novel style games in the Unity game engine, though it can
also be used for basic dialogue. OpenDialogue for Unity is available for free on both the Unity
Asset Store and Github.
Quickstart
To begin writing dialogue, create an empty gameobject and add the Master.cs, coderunner.cs,
ChoiceManager.cs, EndingManager.cs, Inventory.cs, ImageEnumManager.cs, and
ValueTracker.cs scripts.
Then, add a dialogue graph by right-clicking -> create -> dialogue graph.
Then double-click on the dialogue graph to open it. Then, right click and click on the "Frame"
option to add a dialogue box.
2
Now, open the default scene. Open the "Game" gameobject. Drag the dialogue graph you just
created into the Dialogue Graph field at the top.
To add the dialogue spoken to the player, put it in the dialogue field of the box.
To add options, add them to the options field of the box. To add the name tags to the characters,
you will need to open the setting dropdown and then the name options dropdown to set the
name tags for characters 1-3 as well as if characters 1-3 are shown.
An example of how you can set up the character name tags
Finally, you will need to add the character portraits. To add character portraits, you will open the
frame.cs file and scroll down to find the characterImages enum. Then, add the name of the
portrait you want to add.
How your character image enum should look when you're done
Then, go to the image enum manager script in the Game object and click plus to add the key
value pair with the tag you added to the enum and drag the sprite you want for the portrait next
to the name.
To add the character portraits to the dialogue, open the settings dropdown and the the graphic
options dropdown and set the character portrait options for slots 1-3.
If the name tag option for the corresponding portrait is not selected, then the portrait will not
show.
3
The same process is used for adding the background image, you will just need to find the
backgroundImages enum in frame.cs instead of characterImages.
Finally, remember to check the “root” box in the node of the first dialogue item. This tells the
dialogue system which node to start the dialogue on.
Understanding Skipping
If you look at the dialogue nodes input port, you will see that it has input port A and input port B.
This is useful if you want to have more than one node lead to the same node. However, if you
have more than two nodes that you want to lead to the same option, you need to create a
“merger” node that takes in the two nodes as input and then can go into another node. The logic
is a bit difficult to explain, so refer to the diagram below.
Understanding the choices system
If you want the player's choices to be able to affect the story without manually creating large
trees of options, you need to use conditions.
There are 3 types of conditions: inventory, value, and choice. Choices are an array of numbers
stored in the choiceManager on the game GameObject.
4
A choice condition simply checks whether the choice at a certain index is equal to another
number. If it is, then the condition returns true.
The value tracker checks whether a certain tracked variable is less than, greater than, or equal
to another value.
If it is, it returns true.
An inventory condition checks if the player's inventory contains a certain item. If the condition is
set to none, it returns true. You use conditions to hide certain options if the player hasn't met a
condition.
Each item of the condition list will correspond to another item in the options list. You can have
multiple conditions for a single option.
The "ifSkipOneConditions" is only useful if the dialogue box is a skip and you want the player to
be sent to one dialogue box if a certain condition is true, if else, go to another block.
If the conditions listed in the "if skip one conditions" list are all true, and the box is a skip, then it
will skip to option 2 instead of option 1.
This system allows you to save time while developing complex story logic.
5