Getting started with the DialogueSystem


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:

  • DialogueSystem: the parent of all of the dialogue system, it contains components related to the overall control of the asset including input, yarn spinner related scripts and the DialogueView script.
  • Canvas: the canvas which holds all of the UI elements. 
  • Background image: the image behind the dialgoue box, when you load it in it will be black but you can change the colour or image as you wish. 
  • Scroll view: this allows for you to be able to scroll through the text, currently this can only be done with your mouse but i want to include a scroll bar in the future.
  • Viewport: the area of the scroll view you can see
  • Content: all lines of text will become children of the content object. 
  • Character Image: where the image of the character will be if you’ve set up the character in a character scriptable object. You can move this as you like.

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:


  •  CharacterList:link to the character list scriptable object goes here (look at the next section about this)
  • Dulled Option Colour: the colour of an option that is not currently selected
  • Standard Text Colour: the colour of an option that is currently selected, or the main colour you want your dialogue to be. 
  • Font Asset: put the TMP_Font you want your dialogue to be in here
  • Font Size: the size of your font 
  • Space between Lines: added space between different dialogues.

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. 

 

Get Branching Dialogue System (Unity)

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.