# 텍스트 설정하기

Text Animator에 텍스트를 두 가지 서로 다른 UI 시스템에서 설정할 수 있습니다:

* [#ui-toolkit](#ui-toolkit "mention")
* [#text-mesh-pro](#text-mesh-pro "mention")

{% hint style="info" %}
이 페이지에는 이미 [설치 및 빠른 시작](/text-animator-unity/3.x-ko/quick-start/install-and-quick-start.md)에 있는 일부 정보뿐만 아니라, 각 시스템 및 전반적인 내용에 대한 다른 세부 정보와 제안도 포함되어 있습니다. 꼭 [#best-practices](#best-practices "mention") 섹션을 읽어 보세요!&#x20;
{% endhint %}

***

## UI Toolkit

{% hint style="success" %}
이제 다 끝났습니다!! 이제 준비되었습니다 [효과 추가 방법](/text-animator-unity/3.x-ko/effects/how-to-add-effects.md)
{% endhint %}

***

## Text Mesh Pro

{% hint style="success" %}
이제 다 끝났습니다!! 이제 준비되었습니다 [효과 추가 방법](/text-animator-unity/3.x-ko/effects/how-to-add-effects.md)
{% endhint %}

{% hint style="warning" %}
빈 텍스트가 보인다면(하지만 컴포넌트에는 설정해 두었다면), TextMeshPro 컴포넌트를 적어도 한 번 클릭하고 "Essentials"를 가져왔는지 확인하세요(해당 창이 팝업되면 그렇게 하라는 안내가 나옵니다).
{% endhint %}

#### 코드로 텍스트를 설정할 때의 모범 사례

코드로 TextMeshPro 오브젝트에 텍스트를 설정하려면, 다음과 같이 TMPro 대신 Text Animator의 스크립트를 참조해 주세요:

```csharp
using UnityEngine;
using TMPro; 
using Febucci.TextAnimatorForUnity.TextMeshPro; // <- Text Animator의 네임스페이스를 가져옵니다

public class ExampleScript : MonoBehaviour
{
    [SerializeField] TMP_Text textMeshPro;
    [SerializeField] TextAnimator_TMP textAnimator;

    void Start()
    {
        // 🚫 하지 마세요: TMPro를 통해 텍스트 설정
        textMeshPro.SetText("<wave>hello");

        // ✅ 이렇게 하세요: Text Animator를 통해 직접 텍스트 설정
        textAnimator.SetText("<wave>hello");
    }

}
```

{% hint style="info" %}
참고: TMPro를 참조해도 동작은 하겠지만, TextAnimator로 텍스트를 설정하는 편이 텍스트를 더 잘 제어할 수 있어 통합이 더 잘 됩니다.
{% endhint %}

***

## 모범 사례

### 전체 텍스트/대화는 한 번만 설정하세요

텍스트는 한 번만 설정하고, 타자기 / 표시 방법을 사용해 어떻게 나타날지 제어해 보세요.

{% hint style="info" %}
나중에 정말로 텍스트를 덧붙여야 한다면, "textAnimator.AppendText" 메서드를 사용할 수 있습니다.
{% endhint %}

<details>

<summary>예제</summary>

만약 어떤 캐릭터가 "Helloooo how are you doing?"라고 말하고, 이를 글자별로 표시하고 싶다면, 그냥 이렇게 하면 됩니다: `typewriter.ShowText("Hellooooo how are you doing?");` 이것만 하면 됩니다! [글자를 동적으로 표시하고 숨기기](/text-animator-unity/3.x-ko/typewriter/show-and-hide-letters-dynamically.md)

***

동적 문자열을 만드는 중이라면, 그 값을 타자기/애니메이터에 설정하기 전에 먼저 만들어 둘 수 있습니다.

```csharp
int apples = 5; // 나중에 게임 상태에서 가져옴
string playerName = "Bob";

// 전체 대화 줄을 먼저 만듭니다
string dialogue = $"안녕하세요 {playerName}님, 사과가 {apples}개 있습니다";

// 그런 다음 텍스트를 한 번만 설정합니다
typewriter.ShowText(dialogue);
```

(대화 시스템을 사용 중이라면, 그 작업은 시스템이 대신해 줄 것입니다 - 걱정하지 마세요 ! [통합](/text-animator-unity/3.x-ko/integrations/integrated-plugins-and-dialogues-systems.md))

</details>

<details>

<summary>왜 문자를 하나씩 설정하는 대신 전체 텍스트를 한 번만 설정해야 하나요?</summary>

성능 때문입니다! (Text Animator가 없어도 마찬가지입니다.)

텍스트를 설정할 때마다 TextMeshPro 또는 UI Toolkit은 메쉬, 위치 지정 등을 계산해야 하고, 이후 Text Animator는 문자 지속 시간 등을 다시 계산해야 합니다. 즉, 초당 여러 번 변경하면(예: 글자를 더 추가하는 경우) 매번 이러한 계산을 수행하게 됩니다.

문자를 하나씩 표시하려면, 전체 텍스트를 한 번만 설정한 다음 타자기를 시작하면 됩니다: [글자를 동적으로 표시하고 숨기기](/text-animator-unity/3.x-ko/typewriter/show-and-hide-letters-dynamically.md)&#x20;

</details>


---

# 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/3.x-ko/effects/setting-up-texts.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.
