> For the complete documentation index, see [llms.txt](https://docs.yarnspinner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yarnspinner.dev/3.1/api/csharp/yarn.unity/yarn.unity.dialoguepresenterbase/yarn.unity.dialoguepresenterbase.runoptionsasync-1.md).

# RunOptionsAsync(DialogueOption\[],CancellationToken)

Method in [DialoguePresenterBase](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguepresenterbase.md)

{% hint style="warning" %}
This method is obsolete and may be removed from a future version of Yarn Spinner: The LineCancellationToken form of RunOptionsAsync allows for option cancellation and hurrying up and is prefered.
{% endhint %}

## Summary

Called by the [DialogueRunner](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner.md) to signal that a set of options should be displayed to the user.

```csharp
public virtual YarnTask<DialogueOption?> RunOptionsAsync(DialogueOption[] dialogueOptions, CancellationToken cancellationToken)
```

## Remarks

This method is called when the Dialogue Runner wants to show a collection of options that the user should choose from. Each option is represented by a [DialogueOption](/3.1/api/csharp/yarn.unity/yarn.unity.dialogueoption.md) object, which contains information about the option.

When this method is called, the Dialogue Presenter should display appropriate user interface elements that let the user choose among the options.

This method should await until an option is selected, and then return the selected option. If this view doesn't handle options, or is otherwise unable to select an option, it should return `YarnAsync.NoOptionSelected`. The dialogue runner will wait for all dialogue views to return, so if a dialogue presenter doesn't or can't handle options, it's good practice to return as soon as possible.

If the `cancellationToken` becomes cancelled, this means that the dialogue runner no longer needs this Dialogue presenter to make a selection, and this method should return as soon as possible; its return value will not be used.

{% hint style="info" %}
The default implementation of this method returns `YarnAsync.NoOptionSelected`.
{% endhint %}

## Parameters

| Name                                                                                                     | Description                                                                                                                                         |
| -------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Yarn.Unity.DialogueOption\[\]](/3.1/api/csharp/yarn.unity/yarn.unity.dialogueoption.md) dialogueOptions | The set of options that should be displayed to the user.                                                                                            |
| `System.Threading.CancellationToken` cancellationToken                                                   | A `System.Threading.CancellationToken` that becomes cancelled when the dialogue runner no longer needs this dialogue presenter to return an option. |

## Returns

A task that indicates which option was selected, or that this dialogue presenter did not select an option.

## See Also

* [DialoguePresenterBase.RunLineAsync(LocalizedLine,LineCancellationToken)](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguepresenterbase/yarn.unity.dialoguepresenterbase.runlineasync.md): Called by the [DialogueRunner](/3.1/api/csharp/yarn.unity/yarn.unity.dialoguerunner.md) to signal that a line should be displayed to the user.
* YarnAsync.NoOptionSelected


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.yarnspinner.dev/3.1/api/csharp/yarn.unity/yarn.unity.dialoguepresenterbase/yarn.unity.dialoguepresenterbase.runoptionsasync-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
