Language:

Dialogue Runner

Dialogue Runners and Systems

The Dialogue Runner is the bridge between the dialogue that you’ve written in your Yarn Spinner Scripts and the other components of your game. It’s a component that’s responsible for loading, running and managing the contents of a Yarn Project, and for delivering the content of your Yarn Spinner Scripts to the other parts of your game, such as your user interface.

You can easily add a Dialogue Runner to your scene as part of a prefab that we supply named Dialogue System.

Dialogue Runner

The Dialogue Runner is the bridge between the dialogue that you’ve written in your Yarn scripts and the other components of your game. It’s a component that’s responsible for loading, running and managing the contents of a Yarn Project, and for delivering the content of your Yarn scripts to the other parts of your game, such as your user interface.

Setting up a Dialogue Runner is the first step in adding dialogue to your game. To use a Dialogue Runner, you add the DialogueRunner script to a node in your scene, connect it to Dialogue Presenters, and provide it with a Yarn Project to run.

When you want to start running the dialogue in your game, you call the Dialogue Runner’s StartDialogue method. When you do this, the Dialogue Runner will begin delivering lines, options and commands to its Dialogue Presenters.

You can also tell it to start automatically by choosing the relevant checkbox in the Inspector.

The Dialogue Runner is designed to work with other components of Yarn Spinner for Godot:

  • The contents of your dialogue are delivered to your Dialogue Presenters.
  • The values of variables are stored and retrieved using the Dialogue Presenter’s Variable Storage.
  • Content that users should see, including the text in their current language, voice over clips, and other assets, are retrieved using the Dialogue Runner’s Line Provider.

The bare-bones minimum that a Dialogue Runner needs in order to work is a Yarn Project and at least one Dialogue Presenter.

If you don’t set up a Variable Storage or a Line Provider, the Dialogue Runner will use temporary placeholders.

Inspector

PropertyDescription
Yarn ProjectThe Yarn Project that this Dialogue Runner is running.
Variable StorageThe Variable Storage to store and retrieve variable data from. If you do not set this, the Dialogue Runner will create an In Memory Variable Storage for you at runtime.
Line ProviderThe Line Provider to use to get user-facing content for each line. If you do not set this, the Dialogue Runner will create a Text Line Provider for you at runtime.
Dialogue PresentersThe Dialogue Presenters to send lines, options and commands to. Add nodes that have scripts implementing the DialoguePresenterBase interface to this list in order for them to handle your dialogue lines and options. If a node that is added to this list does not implement DialoguePresenterBase, it will not function as a view, and an error explaining this will be logged to the output console.
Start AutomaticallyIf this is turned on, the Dialogue Runner will start running the node named Start Node when the scene starts. If this is not turned on, you will need to call StartDialogue to start running.
Start NodeIf Start Automatically is turned on, the Dialogue Runner will start running this node when the scene starts. (If your Yarn Project does not contain a node with this name, an error will be reported.)
Run Selected Options as LinesIf this is turned on, when the user chooses an option, the Dialogue Runner will run the selected option as if it were a Line.
Verbose LoggingIf this is turned on, the Dialogue Runner will log information about the state of each line to the Console as it’s run.

Signals

SignalDescription
onNodeStartA signal that’s emitted when the Dialogue Runner begins running a new node. This may be fired multiple times during a dialogue run.
onNodeCompleteA signal that’s emitted when the Dialogue Runner reaches the end of a node. This may be fired multiple times during a dialogue run.
onDialogueCompleteA signal that’s emitted when the Dialogue Runner stops running dialogue.
onCommandA signal that’s emitted when a Command is encountered. This will only be called if no other part of the system has already handled the command, such as command handlers registered via YarnCommand or AddCommandHandler.