> 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/c/c-1.md).

# 사용자 정의 액션 작성 (C#)

사용하는 것 외에도 [내장 동작](https://docs.febucci.com/text-animator-unity/typewriter/wait-actions-when-typing), 스크립트(C#)로 직접 작성할 수 있습니다.

***

### 동작 기본 클래스 <a href="#actions-base-class" id="actions-base-class"></a>

새 클래스를 만들 때는 다음을 상속하십시오 `Febucci.UI.Actions.ActionScriptableBase` ([스크립팅 API](https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.Actions.ActionScriptableBase.html)).

```csharp
public class CustomAction : ActionScriptableBase
{
    //[...]
```

### 속성 <a href="#attributes" id="attributes"></a>

이벤트와 마찬가지로 ScriptableObject를 생성하고 있으므로 인스턴스화하고 직렬화하려면 필요한 속성들도 추가해야 합니다:

```csharp
[CreateAssetMenu(fileName = "YourCustomAction", menuName = "Text Animator/Custom/YourCustomAction")]
[System.Serializable]
public class CustomAction : ActionScriptableBase
{
    //[...]
```

이렇게 하면 프로젝트 창에서 이를 생성할 수 있습니다.

### DoAction 메서드 <a href="#doaction-method" id="doaction-method"></a>

그다음 해야 할 일은 “DoAction” 메서드를 오버라이드하고 그 안에 코드를 작성하는 것입니다.

동작은 **타자기 진행을 일시중지합니다** (예: 플레이어 입력을 기다리거나 시간이 경과할 때까지).

```csharp
public override IEnumerator DoAction(ActionMarker action, TypewriterCore typewriter, TypingInfo typingInfo)
{
    //[...]
}
```

* 해당 `동작` 매개변수에는 태그에 대한 유용한 정보(예: ID 또는 함께 전달되는 매개변수)가 포함되어 있습니다(예: `<playSound=02>`).
* 해당 `typewriter` 현재 동작을 수행하고 있는 컴포넌트를 참조합니다
* 해당 `typingInfo` 타자기 내부의 현재 타이핑 속도(수정할 수 있음)와 경과 시간과 같은 정보를 포함합니다.

다음 항목을 참조하십시오 <mark style="color:기본;background-color:orange;">스크립팅 API</mark> 클래스와 기타 항목을 완전히 살펴보려면.

***

### ✅ 완료! <a href="#done" id="done"></a>

완료! 이 간단한 절차로 원하는 모든 사용자 정의 동작을 추가할 수 있습니다.

추신. 프로젝트 뷰에서 action ScriptableObject를 생성하고 액션 데이터베이스에 추가하는 것을 잊지 마세요.
