# 글자를 동적으로 표시 및 숨기기

다음을 사용할 수 있습니다 `타자기` 문장 부호, 글자 등 어떤 종류의 문자(구두점, 문자, \[…])에 대해서도 서로 다른 일시정지를 선택하고, 이벤트를 트리거하는 등 동적으로 글자를 표시하고 숨기기 위해.

{% hint style="info" %}
타자기는 연결된 Text Animator를 사용합니다 **시간 스케일** 으로 시간을 진행합니다. 자세한 내용은 여기를 읽어보세요: [undefined-1](https://docs.febucci.com/text-animator-unity/2.x-ko/undefined-1/undefined-1/undefined-1 "mention")
{% endhint %}

***

## 텍스트 표시 <a href="#showing-text" id="showing-text"></a>

타자기에는 여러 종류가 있습니다. 예를 들어 “`문자별`” 는 한 글자씩 표시하거나, “`단어별`” 는 단어 단위로 텍스트를 진행합니다.

어떤 타자기를 사용할지 선택한 후(즉, TextAnimator가 있는 동일한 GameObject에 컴포넌트를 추가한 후) 다음 두 가지 주요 방법으로 시작할 수 있습니다:

### A) 코드로 (권장) <a href="#a-via-code-recommended" id="a-via-code-recommended"></a>

다음을 바꿉니다 “`tmproText.text = textValue;`” 를 `typewriter.ShowText(textValue);` 로 코드에서 ([스크립팅 API](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TypewriterCore.html#Febucci_UI_Core_TypewriterCore_ShowText_System_String_)).

{% hint style="danger" %}
텍스트를 코드로 설정하고 있다면 이 단계를 놓치지 마세요! 문제가 발생하면 다음을 확인해 보세요: [undefined](https://docs.febucci.com/text-animator-unity/2.x-ko/undefined-3/undefined "mention")
{% endhint %}

### B) “쉬운 통합”을 통해 <a href="#b-via-the-easy-integration" id="b-via-the-easy-integration"></a>

다음을 활성화하기`타자기가 자동으로 시작됨`” 옵션을 TextAnimator 컴포넌트에서 활성화합니다 (참고: 이전에는 “쉬운 통합”이라고 불렸습니다).\
이렇게 하면 플러그인이 TextMeshPro 컴포넌트의 텍스트 변경을 자동으로 확인하고 이에 따라 타자기를 시작합니다.

![](https://2318413514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJE1tNTWPRG3py6Cs3USD%2Fuploads%2FTzcS2yuX8e5hE4uSJTW6%2Ftextanimator%20typewriter%20starts%20automatically.png?alt=media)

![](https://2318413514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJE1tNTWPRG3py6Cs3USD%2Fuploads%2FteoKAfKwf9pFdkQcdyKN%2Ftmpro%20box%20text%20changes.png?alt=media)

***

## 글자 제어

### 타이핑 시작 및 중지 <a href="#start-and-stop-typing" id="start-and-stop-typing"></a>

컴포넌트의 인스펙터 안에는 타자기 시작을 어떻게 트리거할지 제어하는 몇 가지 옵션이 있습니다:

![](https://2318413514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJE1tNTWPRG3py6Cs3USD%2Fuploads%2FKT1LRHcczgFX66AOItmX%2Ftext%20animator%20typewriter%20start.png?alt=media)

* `타자기 시작 모드`: 타자기가 언제 글자 표시를 시작할지 알려줍니다.

<table><thead><tr><th width="300">값</th><th>설명</th></tr></thead><tbody><tr><td><strong>스크립트에서만</strong></td><td>타자기는 다음을 호출할 때만 시작할 수 있습니다 <a href="https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TypewriterCore.html#Febucci_UI_Core_TypewriterCore_ShowText_System_String_">TextAnimatorPlayer.StartShowingText()</a></td></tr><tr><td><strong>OnEnable</strong></td><td>GameObject가 활성화될 때마다 타자기가 시작됩니다</td></tr><tr><td><strong>OnShowText</strong></td><td>새 텍스트가 설정되는 즉시 타자기가 시작됩니다 (<a href="#showing-text">“텍스트 표시” 섹션에 설명된 대로</a>)</td></tr><tr><td><strong>모든 이벤트에서 자동으로</strong></td><td>위의 모든 것</td></tr></tbody></table>

* `시작 시 타이핑 속도 재설정`: 새 텍스트가 표시될 때마다 타자기 속도를 1로 재설정하려면 true로 설정하세요. 그렇지 않으면 마지막에 사용한 속도를 유지합니다.

{% hint style="success" %}
다음 호출로 언제든지 타자기를 일시정지할 수 있습니다 [typewriter.StopShowingText()](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TypewriterCore.html#Febucci_UI_Core_TypewriterCore_StopShowingText), 그리고 다음 호출로 시작/재개할 수 있습니다 [typewriter.StartShowingText()](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TypewriterCore.html#Febucci_UI_Core_TypewriterCore_ShowText_System_String_).
{% endhint %}

{% hint style="success" %}
또한 인스펙터에서 재생 모드로 이 동작을 테스트할 수 있습니다(버튼들은 편집 모드에서는 비활성화되어 있습니다).
{% endhint %}

### 전체 텍스트 건너뛰기 <a href="#skip" id="skip"></a>

타자기를 전체 건너뛰려면 다음을 호출할 수 있습니다 [typewriter.SkipTypewriter()](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TypewriterCore.html#Febucci_UI_Core_TypewriterCore_SkipTypewriter) 메서드.

동작 방식을 제어할 수 있는 몇 가지 옵션도 찾을 수 있습니다:

* `건너뛰기 시 등장 효과 숨기기`: 타자기가 건너뛸 때 등장 효과가 재생되는 것을 방지하여 텍스트가 즉시 표시되도록 하려면 true로 설정하세요.
* `건너뛰기 시 이벤트 트리거`: 타자기가 건너뛰면 나머지 모든 이벤트를 한꺼번에 트리거하려면 true로 설정하세요(게임 로직을 이 이벤트들과 함께 실행 중이라면 주의하세요. 모든 것이 한 번에 실행됩니다). 이벤트에 관해서는 여기에서 더 읽어보세요: [undefined-2](https://docs.febucci.com/text-animator-unity/2.x-ko/typewriter/undefined-2 "mention")

### 텍스트의 특정 부분 건너뛰기

다음 태그 "<`notype>`" 를 사용하여 텍스트의 특정 구간에서 타자기를 건너뛸 수 있습니다. 예를 들어 "`안녕하세요 <notype>저는 즉시 표시됩니다</notype> 그리고 이제 저는 다시 정상적으로 타이핑됩니다.`"

{% hint style="success" %}
전역 설정에서 이 태그를 변경할 수도 있으니, 다른 태그를 사용하고 싶다면 설정하세요.
{% endhint %}

### 텍스트 숨기기 <a href="#hiding-text" id="hiding-text"></a>

스크립트로 글자를 동적으로 숨기려면 다음을 호출하세요 [typewriter.StartDisappearingText()](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TypewriterCore.html#Febucci_UI_Core_TypewriterCore_StartDisappearingText), 그리고 언제든지 다음을 호출하여 중지할 수 있습니다 [typewriter.StopDisappearingText()](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TypewriterCore.html#Febucci_UI_Core_TypewriterCore_StopDisappearingText).

런타임 동안 인스펙터의 버튼을 통해서도 이를 테스트할 수 있습니다.

***

{% hint style="info" %}
자체 타자기를 만들 수 있습니다 (읽어보세요 [여기 ](https://docs.febucci.com/text-animator-unity/2.x-ko/c/c)C#을 통해 커스텀 타자기를 만드는 방법) 또는 내장된 것을 사용할 수 있습니다.
{% endhint %}

## 옵션 <a href="#options" id="options"></a>

타자기는 동일한 설정을 공유할 수 있고 특정 설정을 가질 수도 있으므로 인스펙터에서 해당 필드 위에 마우스 커서를 올려 각 필드의 툴팁을 확인하세요.

![](https://2318413514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJE1tNTWPRG3py6Cs3USD%2Fuploads%2FaYCnpGn5bQvKX9EOE5Vq%2Ftext%20animator%20unity%20typrewriter%20next%20tmp.png?alt=media)

다음은 가장 중요하고 일반적인 것들의 빠른 개요입니다:

### 콜백 (Unity 이벤트) <a href="#callbacks-unity-events" id="callbacks-unity-events"></a>

타자기 활동을 기반으로 트리거되는 Unity 이벤트를 사용할 수 있습니다 (예: 텍스트 표시가 끝났을 때).

![](https://2318413514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJE1tNTWPRG3py6Cs3USD%2Fuploads%2Ff2Ss9H7cNm5dFJt1hbqp%2Ftext%20animator%20typewriter%20events.png?alt=media)

<table><thead><tr><th width="288">이벤트</th><th>설명</th></tr></thead><tbody><tr><td><code>텍스트 표시 완료 시</code></td><td>전체 텍스트가 표시된 후 호출되는 이벤트 (<em>“타자기 사용”을 true로 설정한 경우 모든 글자가 표시될 때까지 대기합니다</em>)</td></tr><tr><td><code>텍스트 사라짐 완료 시</code></td><td>스크립트가 마지막 글자 숨기기를 시작하는 즉시 호출됩니다</td></tr></tbody></table>

아래의 항목들은 “**타자기 사용**” 가 **true**:

<table><thead><tr><th width="288">이벤트</th><th>설명</th></tr></thead><tbody><tr><td><code>타자기 시작 시</code></td><td>타자기가 첫 글자를 표시하기 바로 전에 호출됩니다.<br>타자기가 꺼져 있으면 작동하지 않습니다. 그 경우에는 “텍스트 표시 완료 시” 이벤트와 동시에 발생할 수 있기 때문입니다. <em>(이 경우 대신 해당 이벤트를 사용할 수 있습니다)</em></td></tr><tr><td><code>문자 가시 시(문자)</code></td><td>문자가 보일 때마다 호출됩니다</td></tr><tr><td><code>메시지(이벤트 마커) 시</code></td><td>타자기가 텍스트에서 메시지/이벤트를 만날 때마다 호출됩니다. 이벤트에 대해서는 더 읽어보세요 <a href="undefined-2">여기</a></td></tr></tbody></table>

{% hint style="info" %}
타자기 옵션(예: 지연)에 마우스를 올려 툴팁과 추가 정보를 표시할 수 있습니다!
{% endhint %}
