# Unity 可视化脚本

您可以从包管理器安装 Unity 的 Visual Scripting，自 Unity 2021 及更高版本起可用。

{% hint style="info" %}
在以下 Unity Visual Scripting 版本测试的包：1.8.0
{% endhint %}

要在 Unity Visual Scripting 中使用 Text Animator，请务必转到项目设置 -> Visual Scripting -> Nodes，并在此处添加 TextAnimator 的运行时程序集，如下所示：

<figure><img src="/files/5c584948329380658ce881ed3581bfe16a995b5a" alt=""><figcaption></figcaption></figure>

您还应添加任何集成的程序集（例如 "Febucci.TextAnimator.TMP.Runtime"）。然后，点击“Regenerate Nodes”。\
现在您将能够在视觉脚本图中使用所有 TextAnimator 方法，例如打字机的“ShowText”和“Start Typewriter”。\
您可以在此处找到 TextAnimator 脚本 API，或直接在 Visual Scripting 图中创建一个新节点：

<figure><img src="/files/1d1d32d1bba40bbdde0bbee676450fdc636e8131" alt=""><figcaption></figcaption></figure>

为了订阅 TextAnimator 事件（例如在字符显示时播放音频），您需要创建一个自定义事件。\
为此，您可以导入位于 TextAnimator 文件夹中的“Visual Scripting - Integration”包，或者手动创建一个 C# 类，作为 Text Animator 与 Unity Visual Scripting 之间的“桥梁”，如下所示：  附注：请确保将其程序集包含在 Visual Scripting 设置的“Nodes”部分（然后点击“regenerate nodes”），就像之前为 Text Animator 所做的那样。现在您将能够在图中使用这些事件触发器，如下所示：&#x20;

<figure><img src="/files/633a863107349c5e2d7ddd7f28706cbdef0a2fe4" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/190840cb1736e5d1caf38061fa36c98a5e607b0f" alt=""><figcaption></figcaption></figure>


---

# 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/unity-ke-shi-hua-jiao-ben.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.
