> For the complete documentation index, see [llms.txt](https://docs.febucci.com/text-animator-unity/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.febucci.com/text-animator-unity/2.x-ko/undefined-3/undefined.md).

# 모범 사례

{% hint style="info" %}
모든 프로젝트는 다르지만, 이 페이지에서는 설정을 더 잘하고 가장 흔한 문제들을 피하는 데 도움이 되는 몇 가지 일반적인 모범 사례를 찾을 수 있습니다!
{% endhint %}

### TextMeshPro 대신 Text Animator의 "SetText/ShowText" 메서드를 사용하세요

코드로 텍스트를 설정하는 경우 TextMeshPro 대신 Text Animator 또는 그 타입라이터를 직접 사용하세요.

```csharp
// 일부 코드
TMP_Text tmpText;
Febucci.UI.Core.TAnimCore textAnimator;
Febucci.UI.Core.TypewriterCore typewriter;

// [...] 이렇게 하세요
textAnimator.SetText(value); // 텍스트를 즉시 설정하려면
//또는 
typewriter.ShowText(value); // 타입라이터가 있는 경우 이렇게 설정하려면
```

참고용 API: [textAnimator.SetText](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TAnimCore.html#Febucci_UI_Core_TAnimCore_SetText_System_String_), [typewriter.ShowText](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TypewriterCore.html#Febucci_UI_Core_TypewriterCore_ShowText_System_String_)

***

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

가능하면 텍스트를 한 번만 설정하고 타입라이터/가시성 메서드로 표시 방식을 제어하세요.

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

<details>

<summary>예시</summary>

캐릭터가 "Helloooo how are you doing?"라고 말하고 이를 한 글자씩 표시하고 싶다면, 간단히 다음과 같이 하세요: `typewriter.ShowText("Hellooooo how are you doing?");` 이게 전부입니다! [글자를 동적으로 표시 및 숨기기](/text-animator-unity/2.x-ko/typewriter/undefined.md)

***

동적 문자열을 만들고 있다면, 값을 타입라이터/애니메이터에 설정하기 전에 그 작업을 수행할 수 있습니다.

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

// 전체 대사 줄을 먼저 구성하세요
string dialogue = $"Hello {playerName}, you've got {apples} apples";

// 그런 다음 텍스트를 한 번 설정하세요
typewriter.ShowText(dialogue);
```

(대화 시스템을 사용하고 있다면, 그들이 이 작업을 대신 처리해 줄 것입니다 - 걱정 마세요! [통합](/text-animator-unity/2.x-ko/undefined-2/undefined.md))

</details>

<details>

<summary>왜 글자별로가 아니라 전체 텍스트를 한 번만 설정해야 하나요?</summary>

성능 때문입니다! (Text Animator가 없더라도)

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

문자를 하나씩 표시하려면 전체 텍스트를 한 번 설정한 다음 타입라이터를 시작하면 됩니다: [글자를 동적으로 표시 및 숨기기](/text-animator-unity/2.x-ko/typewriter/undefined.md)&#x20;

</details>

***

### TMPro.ForceMeshUpdate() 대신 TextAnimator의 "ScheduleMeshRefresh"를 사용하세요

"tmpText.ForceMeshUpdate"를 호출하면 TextAnimator가 일부 참조를 잃어 문자를 올바르게 표시하지 못할 수 있습니다. 텍스트에서 무언가 변경되어 해당 함수를 호출하고 싶다면 대신 TextAnimator의 "ScheduleMeshRefresh"를 호출해 보세요! \[[스크립팅 API](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TAnimCore.html#Febucci_UI_Core_TAnimCore_ScheduleMeshRefresh)] 이 메서드는 다음 프레임에 수행되지만 모든 참조를 그대로 유지합니다.

***

*텍스트 검사기에서 무언가를 변경했는데 업데이트되지 않는다면 알려주세요!*
