# Yarn Scripts

A Yarn script is a text file containing your dialogue.

{% hint style="info" %}
Yarn scripts need to be added to a [Yarn Project](/2.2/using-yarnspinner-with-unity/importing-yarn-files/yarn-projects.md) in order to be used in your game.
{% endhint %}

## Creating a New File

To create a new Yarn script in Unity, follow these steps:

* Open the Assets menu, and choose Yarn Spinner -> Yarn Script.
* Unity will create a new file. Type in a name for the file, and press return.

![Creating a new Yarn script.](/files/SxI4kzpoPg8KTuTpA61D)

The new file that you've just created will contain a single [node](/2.2/getting-started/writing-in-yarn/lines-nodes-and-options.md#writing-nodes-in-plain-text), which has the same name as the file.

{% hint style="info" %}
Creating a Yarn Script in Unity is exactly the same as creating a `.yarn` file externally (i.e. in macOS Finder or Windows Explorer), and dragging it into the Assets folder of your Unity project, or directly into the Project pane (where the new Yarn Script we created through the process above appeared) in Unity.
{% endhint %}

## Editing Yarn Scripts

To edit a Yarn script, double-click it in Unity. The file will open in your editor. When you save your changes and return to Unity, it will be re-compiled.

{% hint style="info" %}
You can learn about our recommended editor, Visual Studio Code with the official Yarn Spinner Extension at: [Editing with VS Code](/2.2/getting-started/editing-with-vs-code.md).
{% endhint %}


---

# 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/2.2/using-yarnspinner-with-unity/importing-yarn-files/yarn-scripts.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.
