Study/팁

[Tip] 텍스트 코루틴 애니메이션

꽂무남 2024. 7. 16. 14:44

 

 

 

 

 

 

IEnumerator CoTextFlow(string text)
{
    dialogText.text = "";
    string str = null;
    int length = 0;
    bool isScriptEnd = false;
    while (!isScriptEnd)
    {
        foreach (char ch in text)
        {
            str = str + ch;
            yield return new WaitForSeconds(0.035f);
            dialogText.text = str;
        }
        isScriptEnd = true;
    }
}