반응형
| using UnityEngine; | |
| using System.Collections; | |
| using UnityEngine.UI; | |
| // attach to UI Text component (with the full text already there) | |
| public class UITextTypeWriter.cs : MonoBehaviour | |
| { | |
| Text txt; | |
| string story; | |
| void Awake () | |
| { | |
| txt = GetComponent<Text> (); | |
| story = txt.text; | |
| txt.text = ""; | |
| // TODO: add optional delay when to start | |
| StartCoroutine ("PlayText"); | |
| } | |
| IEnumerator PlayText() | |
| { | |
| foreach (char c in story) | |
| { | |
| txt.text += c; | |
| yield return new WaitForSeconds (0.125f); | |
| } | |
| } | |
| } https://unitycoder.com/blog/2015/12/03/ui-text-typewriter-effect-script/ |
반응형
'Unity' 카테고리의 다른 글
| 코루틴 콜백 받기 (0) | 2018.10.28 |
|---|---|
| 서버로 Post 보내기 (0) | 2018.10.27 |
| 자식객체 검색 (0) | 2018.10.16 |
| Intellij Rider에서 중괄호 Java형식으로 바꾸기 (0) | 2018.10.15 |
| 드래그 (0) | 2018.10.11 |