Dialogue Runner

Learn about the Dialogue Runner, which runs the contents of your Yarn Scripts and delivers lines, options and commands to your game.

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 it to a game object in your scene, connect it to Dialogue Views, 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 Views.

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

  • The contents of your dialogue are delivered to your Dialogue Views.

  • The values of variables are stored and retrieved using the Dialogue Runner's Variable Storage.

  • The content that users should see - that is, the text in their current language, voice over clips, and other asset - 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 View. If you don't set up a Variable Storage or a Line Provider, the Dialogue Runner will use temporary placeholders.

Inspector

PropertyDescription

Yarn Project

Variable Storage

Line Provider

Dialogue Views

Start Automatically

Start Node

If 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.)

Automatically Continue Lines

Run Selected Options as Lines

If 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 Logging

If this is turned on, the Dialogue Runner will log information about the state of each line to the Console as it's run.

On Node Start

A Unity Event that's fired when the Dialogue Runner begins running a new node. This may be fired multiple times during a dialogue run.

On Node Complete

A Unity Event that's fired when the Dialogue Runner reaches the end of a node. This may be fired multiple times during a dialogue run.

On Dialogue Complete

A Unity Event that's fired when the Dialogue Runner stops running dialogue.

On Command

Last updated

Yarn Spinner® and Secret Lab® are trade marks of Secret Lab Pty. Ltd., and are used by Yarn Spinner Pty. Ltd. under license.