# Yarn Spinner

[Yarn Spinner（开源）：网站](https://yarnspinner.dev/).

### Yarn Spinner 2.X 与 Unity 的 Text Animator

您可以以两种主要方式集成 Yarn Spinner 2.X。

* 第一种是使用 TextAnimator 的打字机（因此禁用 Yarn Spinner 的打字机），如果您想使用 Text Animator 的所有功能，例如暂停打字机、等待玩家输入等，这是首选。
* * 在 “Line View” 脚本中，禁用 “Use Typewriter” 和 “Use Fade Effect”。
  * 将组件 TextAnimator\_TMP 和 TypewriterByCharacter 添加到您的对话文本，如 [集成的插件与对话系统](/text-animator-unity/2.x-zh/ji-cheng/ji-cheng-de-cha-jian-yu-dui-hua-xi-tong.md).
  * *附注：根据您设置画布的方式，文本可能会闪烁一帧。如果发生这种情况，请确保在显示新对话行之前以及画布消失时调用 “tmproText.ClearMesh(true)”。例如，如果您有一个 “Continue” 按钮，可按如下方式：*
  * ![tmpro clearmesh event](/files/39b81b474d7427673b4efc57caccfb9becd79e6c)
* 第二种方式是继续使用 Yarn Spinner 的打字机（但您将无法使用 Text Animator 的打字功能）。
* * 在 “Line View” 脚本中，将 “Use Fade Effect” 和 “Use Typewriter Effect” 设置为 true。
  * 向您的对话文本添加 TextAnimator\_TMP 组件，并确保禁用 “Typewriter Starts Automatically”。

### Yarn Spinner 1.X 与 Unity 的 Text Animator

* 使用 TextMeshPro 而不是 Unity 内置的 Text
* 在 “DialogueUI” 组件中，将 “text speed” 设置为 0。
* 在 “DialogueUI” 组件中，将 “OnLineUpdate” 事件设置为 TextMeshPro 的文本。
* ![textanimator integration yarnspinner lineupdate](/files/4145b98398007b07941d05614918f3527dc431bc)
* 将组件 TextAnimator\_TMP 和 TypewriterByCharacter 添加到您的对话文本，如 [集成的插件与对话系统](/text-animator-unity/2.x-zh/ji-cheng/ji-cheng-de-cha-jian-yu-dui-hua-xi-tong.md).


---

# 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.febucci.com/text-animator-unity/2.x-zh/ji-cheng/ji-cheng-de-cha-jian-yu-dui-hua-xi-tong/yarn-spinner.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.
