Text Animator for Unity를 이용한 타자기 출력

2025. 5. 26. 23:31·코드 및 공부/UI

유니티 버전 - 6000.0.49f1

에셋 버전 - 2.3.1

 

 

 

 

목차


  • 에셋 설명
  • 컴포넌트 설정
  • 스크립트

 

 

 

 

 

에셋 설명


https://assetstore.unity.com/packages/tools/gui/text-animator-for-unity-254677?srsltid=AfmBOooCsS2udUlvAMfx7vJf2IoYJKvl0pieJqR4DD0XP7sRG98q-cYp

 

Text Animator for Unity | GUI 도구 | Unity Asset Store

Use the Text Animator for Unity from Febucci Tools on your next project. Find this GUI tool & more on the Unity Asset Store.

assetstore.unity.com

 

Text Animator for Unity는 몇 가지 간단한 단계만으로 텍스트에 생명력을 불어넣는 강력하고 유연한 도구입니다.

 

 

 

 

 

컴포넌트 설정


텍스트가 출력될 TextMeshPro - Text (UI)와 같은 컴포넌트에 Text Animator - Text Mesh Pro와 Typewriter - By Character를 위치시킵니다

 

 

 

Text Animator의 Typewriter Starts Automatic을 활성화합니다

 

 

 

Typewriter의 Start Typewriter Mode를 From Script Only로 설정합니다

 

 

 

 

 

스크립트


변수를 선언합니다

[SerializeField] private TypewriterByCharacter typewriter;
// 실제 대사가 출력될 TMP와 같은 컴포넌트의 Typewriter

[SerializeField] private TextMeshProUGUI dialogueText;
// 실제 대사가 출력될 TMP

private int _currentLine;
// 대사 이벤트가 어디가지 진행됬는지 추적

private bool _isAnimating;
// 현재 출력중인지 추적

 

 

AddListener를 이용하여 텍스트 출력이 완료될때 더이상 출력중이지 않은 상태로 만들어줍니다, 만약, 텍스트를 출력하는 동안 한번더 사용자의 인풋이 있으면 대화를 즉시 모두 출력하고 대기하기위하여 사용됩니다

public override void Init()
{
    base.Init();
        
    typewriter.onTextDisappeared.AddListener(OnIsEndedAnimating); // 이 부분
}


private void OnIsEndedAnimating() 
{
    _isAnimating = false;
}

 

 

현재 _isAnimating 따라 동작을 다르게 해줍니다, 만약 출력중이라면 모두 출력하고 아니라면 다음 텍스트를 출력합니다

private void OnNextDialogue()
{
    if (_isAnimating)
    {
        typewriter.SkipTypewriter(); // 스킵 메서드
            
        _isAnimating = false;
    }
    else
    {
        _currentLine++;
            
        ShowLine(_currentLine); // 다음줄을 출력하기위한 메서드
    }
}

 

 

실제 텍스트를 출력하는 ShowLine 메서드입니다

private void ShowLine(int index)
{
    if (index >= texts.Length) // 만약 이미 전부 출력하였다면 DialoguePopup을 닫음
    {
        Managers.UI.ClosePopup();
        return;
    }
        
    _isAnimating = true;
        
    typewriter.ShowText(texts[index]); // 실제 실행 메서드, texts[index]는 출력할 대사가 담겨있음
    typewriter.StartShowingText(true); // 만약 ShowText() 만 이용했을때 출력이 제대로 안될경우 사용
}

 

 

 

실행 결과입니다

 

 

 

메뉴얼

https://docs.febucci.com/text-animator-unity

 

Text Animator for Unity | Text Animator for Unity

Text Animator for Unity lets you animate your game texts in a few and simple steps, adding effects to letters, a typewriter and much more. Trusted by thousands of developers all over the world - in award winning titles like Dredge, Cult of the Lamb, Slime

docs.febucci.com

 

 

 

스크립팅 API

https://www.api.febucci.com/tools/text-animator-unity/api/Febucci.UI.html

 

Namespace Febucci.UI | Text Animator for Unity

Namespace Febucci.UI Classes Animates a TMP text component, both UI or World. See TAnimCore for the base class information. Contains global settings for Text Animator, like effects enabled status and default databases. Built-in typewriter, which shows lett

www.api.febucci.com

 

'코드 및 공부 > UI' 카테고리의 다른 글

SetValueWithoutNotify()을 이용한 드롭다운 옵션 변경  (0) 2025.03.05
버튼 OnClick에 async 메서드가 등록되지 않는 문제  (0) 2025.03.04
'코드 및 공부/UI' 카테고리의 다른 글
  • SetValueWithoutNotify()을 이용한 드롭다운 옵션 변경
  • 버튼 OnClick에 async 메서드가 등록되지 않는 문제
ekrxjvpvj0110
ekrxjvpvj0110
유니티 개발 관련 자료
  • ekrxjvpvj0110
    ekrxjvpvj0110의 유니티 개발
    ekrxjvpvj0110
    • 전체 글 (75) N
      • 안드로이드 (1) N
        • 에셋 관리 (1) N
      • 코드 및 공부 (73)
        • 이론 (4)
        • 데이터 관리 (11)
        • 입력 관리 (9)
        • 최적화 (10)
        • UI (3)
        • 통신 (0)
        • 카메라 (3)
        • 오디오 (3)
        • 물리 (3)
        • 씬 (6)
        • 기타 (21)
        • 분류없음 (0)
  • 인기 글

  • hELLO· Designed By정상우.v4.10.3
ekrxjvpvj0110
Text Animator for Unity를 이용한 타자기 출력
상단으로

티스토리툴바