Posted September 11, 2023 by MultidimensionalSock
Note: Before you can import the dialogue system package, you first need to install Yarn Spinner and the new input system package, otherwise it will not be able to load in the main prefab due to dependancies.
Once the package is in the Unity project, drag the DialogueSystem prefab into the Scene Hierarchy. Currently when you open it will contain the test project which allows you to ensure it is properly working. From here you can change it how you'd like. Below I'll break down each part of the prefab, and important components parameters you need to know what are in order to change the asset how you'd like.
The prefab itself
The prefab consists of the above elements:
The dialogue view component
The DialogueView component controls how the actual dialogue view works. If you go into the script for it, it is commented to explain what is going on, but this isn't necessary to know to use it. It consists of the following parameters:
When you load the package in there will already be new input system actions loaded in, as well as a test character list, you can use these as a template and just add to them for your own project, but knowing how to make your own will make it easier in the long run.
Creating a character list:
You can create a character list by right clicking on the project window, create > DialogueView > CharacterList
Once your scriptable object is made, click on it and it should show the following
Click on the plus and this will come up.
In the first box put the characters name, this is case sensitive. In the second put the sprite you want associating with them. And then add the colour you want their character name to show a, remember to set the opacity as well.
If you put a character in a yarn script but don't define it in your character list then the dialogue will show up without a name and the picture will be unchanged from the last time it was set. This might be desirable for options or when the player is speaking, but in the yarn script you will still have to put a name/identifier before the dialogue line, just don't associate a character to it.
Input Actions
The test input system is below, if you recreate it then the actions displayed below will need to keep the same name (case sensitive) and keep the same output type (button for NextLine and 1D Axis for PickOptions), but other than that you can change which inputs align to what or add other inputs such as controller support.