First Unity Open Source Package (Dialogue System)

In an effort to just get stuff out the door, I just (pre-) released my first Unity package on GitHub today. It’s a basic run at a Dialogue System that I’m writing for my own projects, using what I’ve learned from these courses, and before RPG part 2 comes out. Version 1.0 is marked as a pre-release as it was developed using a release candidate version of 2019.3 and is not ready for production!

Here’s a link to the GitHub repo, before I get to far into it: https://github.com/Last-Mile-Games/DialogueSystem

Currently you can:

  • Create conversations with dialogue nodes (via scriptable objects)
  • Indicate a narrative choice was made (also via scriptable objects)
  • Identify the speaker both with a picture and a name.
  • Select a response via mouse

Ways I plan on improving the package:

  1. Custom editor windows to visualize branching dialogue
  2. Allow for multiple “speaker images” to let everyone sit in on the conversation (not just the one talking).

I’ll especially keep updating the package as I learn new tricks working on other projects.

Feedback is appreciated!

Just a quick preview of what I’m working on for my Dialogue System project. :grin:

I’m using the GraphView API, the same API that is used for Shader Graph. While GraphView is marked Experimental and is mainly meant for Unity’s internal teams, it’s unlikely to go away.

Learning resources are somewhat scarce as the only documentation is the API reference, which doesn’t really explain how to use it.

This two part YouTube tutorial is what got me started, and digging through the API is helping me to expand on it:

I’m super proud of this. I just finished a ton of the work for the UI on the Dialogue Graph editor.

Link To Project At Latest Commit
(Note: This branch breaks the Dialogue system at runtime, so there’s only playing with the graph in the editor.)

Changes

  • Adds a Condition to Toggle field to the choice ports on dialogue nodes. (DialogueCondition objects in this field will have their runtime Value toggled when selected. Set the _initialValue of the condition in the condition node. To make a value persist past runtime, call DialogueCondition.ApplyNewValue() or DialogueCondition.SetValue())
  • Adds an ObjectField to condition nodes which bind to a DialogueCondition ScriptableObject.
  • Adds ability to create a new DialogueCondition from a condition node when there is no DialogueCondition set.
  • Refactors condition node fields into a foldout so screen space can be saved.
  • Refactors dialogue fields into foldouts so screen space can be saved.
  • Adds styles for the toolbar and nodes.
  • Adds a toggle visibility button for the minimap.
  • Makes minimap moveable

Roadmap

  • Save/Load dialogues into a conversation container (ScriptableObject) that the runtime dialogue scripts will use.
  • Make the button text on all the toolbar controls line up
  • Allow creating nodes when dragging connectors to an empty space (open a context menu when there is no target port).
  • Refactor runtime scripts to use new conversation instead of three types of ScriptableObject.