# DialogueRunner

Class in [Yarn.Unity](/3.1/api/csharp/yarn.unity.md)

Inherits from `UnityEngine.MonoBehaviour`

## Summary

```csharp
public class DialogueRunner : IActionRegistration
```

## Fields

| Name                                                                                                                                 | Description                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [autoStart](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.autostart.md)                             | Whether the dialogue runner will immediately start running dialogue after loading.                                                                                                                                                                                                              |
| [onDialogueComplete](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.ondialoguecomplete.md)           | A Unity event that is called once the dialogue has completed.                                                                                                                                                                                                                                   |
| [onDialogueStart](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.ondialoguestart.md)                 | A Unity event that is called when the dialogue starts running.                                                                                                                                                                                                                                  |
| [onNodeComplete](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.onnodecomplete.md)                   | A Unity event that is called when a node is complete.                                                                                                                                                                                                                                           |
| [onNodeStart](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.onnodestart.md)                         | A Unity event that is called when a node starts running.                                                                                                                                                                                                                                        |
| [onUnhandledCommand](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.onunhandledcommand.md)           | A [UnityEventString](/3.1/api/csharp/yarn.unity/yarn.unity.unityeventstring.md) that is called when a [Command](/3.1/api/csharp/yarn/yarn.command.md) is received and no command handler was able to handle it.                                                                                 |
| [runSelectedOptionAsLine](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.runselectedoptionasline.md) | If this value is set, when an option is selected, the line contained in it ( [Line](/3.1/api/csharp/yarn/yarn.optionset/yarn.optionset.option/yarn.optionset.option.line.md) ) will be delivered to the dialogue runner's dialogue presenters as though it had been written as a separate line. |
| [startNode](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.startnode.md)                             | The name of the node that will start running immediately after loading.                                                                                                                                                                                                                         |
| [verboseLogging](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.verboselogging.md)                   | If true, will print Debug.Log messages every time it enters a node, and other frequent events.                                                                                                                                                                                                  |

## Methods

| Name                                                                                                                                                               | Description                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| [AddCommandHandler(string,Delegate)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.addcommandhandler-1.md)                        | Adds a command handler. Dialogue will pause execution after the command is called.                                                         |
| [AddCommandHandler(string,MethodInfo)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.addcommandhandler-2.md)                      | Adds a command handler. Dialogue will pause execution after the command is called.                                                         |
| [AddFunction(string,Delegate)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.addfunction.md)                                      | Add a new function that returns a value, so that it can be called from Yarn scripts.                                                       |
| [FindRunner(Component)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.findrunner.md)                                              |                                                                                                                                            |
| [LoadStateFromPersistentStorage(string)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.loadstatefrompersistentstorage.md)         | Loads all variables from the requested file in persistent storage into the Dialogue Runner's variable storage.                             |
| [RegisterFunctionDeclaration(string,Type,Type\[\])](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.registerfunctiondeclaration.md) |                                                                                                                                            |
| [RemoveCommandHandler(string)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.removecommandhandler.md)                             | Removes a command handler.                                                                                                                 |
| [RemoveFunction(string)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.removefunction.md)                                         | Remove a registered function.                                                                                                              |
| [RequestHurryUpLine()](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.requesthurryupline.md)                                       | Requests that all dialogue presenters speed up their delivery of the current line.                                                         |
| [RequestHurryUpOption()](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.requesthurryupoption.md)                                   |                                                                                                                                            |
| [RequestNextLine()](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.requestnextline.md)                                             | Requests that all dialogue presenters stop showing the current line, and prepare to show the next piece of content.                        |
| [SaveStateToPersistentStorage(string)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.savestatetopersistentstorage.md)             | Saves all variables from variable storage into the persistent storage.                                                                     |
| [SetProject(YarnProject)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.setproject.md)                                            | Sets the dialogue runner's Yarn Project.                                                                                                   |
| [SplitCommandText(string)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.splitcommandtext.md)                                     | Splits input into a number of non-empty sub-strings, separated by whitespace, and grouping double-quoted strings into a single sub-string. |
| [StartDialogue(string)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.startdialogue.md)                                           | Starts running a node of dialogue.                                                                                                         |
| [Stop()](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.stop.md)                                                                   | Stops the dialogue immediately, and cancels any currently running dialogue presenters.                                                     |

## Properties

| Name                                                                                                                       | Description                                                                                                                                                              |
| -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Dialogue](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.dialogue.md)                     | Gets the internal [Dialogue](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.dialogue.md) object that reads and executes the Yarn script. |
| [DialoguePresenters](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.dialoguepresenters.md) | Gets or sets the collection of dialogue presenters attached to this dialogue runner.                                                                                     |
| [DialogueTask](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.dialoguetask.md)             | Gets a [YarnTask](/3.1/api/csharp/yarn.unity/yarn.unity.yarntask-1.md) that completes when the dialogue runner finishes its dialogue.                                    |
| [DialogueViews](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.dialogueviews.md)           | Gets or sets the collection of dialogue presenters attached to this dialogue runner.                                                                                     |
| [IsDialogueRunning](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.isdialoguerunning.md)   | Gets a value that indicates if the dialogue is actively running.                                                                                                         |
| [IsInPlaymode](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.isinplaymode.md)             |                                                                                                                                                                          |
| [LineProvider](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.lineprovider.md)             | Gets the [ILineProvider](/3.1/api/csharp/yarn.unity/yarn.unity.ilineprovider.md) that this dialogue runner uses to fetch localized line content.                         |
| [NoOptionSelected](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.nooptionselected.md)     |                                                                                                                                                                          |
| [VariableStorage](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.variablestorage.md)       | Gets the VariableStorage that this dialogue runner uses to store and access Yarn variables.                                                                              |
| [YarnProject](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.yarnproject.md)               | Gets the [YarnProject](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.yarnproject.md) asset that this dialogue runner uses.              |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yarnspinner.dev/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
