# onUnhandledCommand

Field in [DialogueRunner](https://docs.yarnspinner.dev/api/csharp/yarn.unity/yarn.unity.dialoguerunner)

## Summary

A [UnityEventString](https://docs.yarnspinner.dev/api/csharp/yarn.unity/yarn.unity.unityeventstring) that is called when a [Command](https://docs.yarnspinner.dev/api/csharp/yarn/yarn.command) is received and no command handler was able to handle it.

```csharp
public UnityEventString? onUnhandledCommand;
```

## Remarks

Use this method to dispatch a command to other parts of your game. This method is only called if the [Command](https://docs.yarnspinner.dev/api/csharp/yarn/yarn.command) has not been handled by a command handler that has been added to the [DialogueRunner](https://docs.yarnspinner.dev/api/csharp/yarn.unity/yarn.unity.dialoguerunner), or by a method on a `UnityEngine.MonoBehaviour` in the scene with the attribute [YarnCommandAttribute](https://docs.yarnspinner.dev/api/csharp/yarn.unity/yarn.unity.yarncommandattribute).

{% hint style="info" %}
When a command is delivered in this way, the [DialogueRunner](https://docs.yarnspinner.dev/api/csharp/yarn.unity/yarn.unity.dialoguerunner) will not pause execution. If you want a command to make the DialogueRunner pause execution, see [AddCommandHandler(string,Delegate)](https://docs.yarnspinner.dev/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.addcommandhandler-1).
{% endhint %}

This method receives the full text of the command, as it appears between the `<<` and `>>` markers.

## See Also

* [DialogueRunner.AddCommandHandler(string,Delegate)](https://docs.yarnspinner.dev/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.addcommandhandler-1): Adds a command handler. Dialogue will pause execution after the command is called.
* [YarnCommandAttribute](https://docs.yarnspinner.dev/api/csharp/yarn.unity/yarn.unity.yarncommandattribute): An attribute that marks a method on an object as a command.
