> 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/typewriter/undefined-2.md).

# 타이핑 시 이벤트 트리거

이벤트는 타이프라이터가 텍스트의 특정 부분에 도달했을 때 임의의 수신자 스크립트로 메시지(문자열)를 보낼 수 있게 해주는 특수 태그입니다. *(이런 이유로 이벤트는 타이프라이터가 활성화된 경우에만 작동합니다)*

<figure><img src="/files/f9acc2273194cead56ce4615edba2aae3242f850" alt="textanimatorgif2febucci"><figcaption><p>장면 '예제 3 - 이벤트'</p></figcaption></figure>

***

## 개요 <a href="#overview" id="overview"></a>

리치 텍스트 태그를 사용하여 텍스트에 이벤트를 작성할 수 있습니다.

### 서식 <a href="#formatting" id="formatting"></a>

이벤트의 메시지는 물음표로 시작합니다. 예: `<?eventMessage>`.

**예:** ‘shakeCamera’라는 이벤트를 호출하려면 다음과 같이 작성하세요: `<?shakeCamera>`

* 👍🏻 이벤트는 내장 효과 태그를 포함하여 모든 종류의 태그를 가질 수 있습니다.
* ⚠️ 이벤트는 대소문자를 구분합니다. 다음을 작성하는 것은 `<?camshake>` 와 같지 않습니다. `<?camShake>`주의하세요! (또는 이를 처리하기 위해 `string.ToLower()` 메서드를 스크립트에서 사용하세요.)

### 매개변수 <a href="#parameters" id="parameters"></a>

이벤트는 하나 또는 여러 매개변수(첫 번째는 `=` 기호로 시작하고 나머지 매개변수는 쉼표로 구분 `,`)를 가질 수 있어 스크립트로 여러 데이터를 보낼 수 있습니다.

* 하나의 매개변수: `<?eventID=parameter1>`, 는 메시지 "eventID"와 하나의 매개변수 "parameter1"을 생성합니다.
* 여러 매개변수: `<?eventID=p1,p2>`, 는 메시지 "eventID"와 매개변수 "p1" 및 "p2"를 생성합니다.

***

## 이벤트 수신하기 <a href="#listening-to-events" id="listening-to-events"></a>

이벤트/메시지를 수신하려는 스크립트는 다음에 구독해야 합니다. `onMessage` 콜백을 `Typewriter` 클래스 내부에. ([스크립팅 API](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.TypewriterCore.html#Febucci_UI_Core_TypewriterCore_onMessage)).

예:

```csharp

//스크립트 내부

public Febucci.UI.Core.TypewriterCore typewriter;

//콜백 수신 추가 및 제거
void OnEnable() => typewriter.onMessage.AddListener(OnTypewriterMessage);
void OnDisable() => typewriter.onMessage.RemoveListener(OnTypewriterMessage);

//이벤트에 따라 동작 수행
void OnTypewriterMessage(Febucci.UI.Core.Parsing.EventMarker eventMarker)
{
    switch (eventMarker.name)
    {
        case "something":
            // 무언가 수행
            break;
    }
}
```

👍🏻 “message” 문자열에는 ‘<’, ‘?’ 및 ‘>’ 문자가 없고 메시지 내용만 포함되어 있다는 점에 유의하세요.

다음을 확인할 수 있습니다 [EventMarker API here](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Core.Parsing.EventMarker.html), 예를 들어 이벤트의 모든 매개변수(있는 경우)를 가져오기 위해.
