Project_WL/Assets/Script/UI/ETC/LoadingUI.cs

35 lines
804 B
C#

using System.Collections;
using TMPro;
using UnityEngine;
public class LoadingUI : MyCoroutine
{
public static LoadingUI Ins;
public GameObject go;
public TextMeshProUGUI m_text;
private string baseText = "Loading";
private int dotCount = 0;
void Awake() { Ins = this; }
public void Start_Loading()
{
go.SetActive(true);
StartCoroutine(AnimateLoadingText());
}
public void End_Loading()
{
go.SetActive(false);
}
IEnumerator AnimateLoadingText()
{
while (true)
{
m_text.text = baseText + new string('.', dotCount);
dotCount = (dotCount + 1) % 4; // 0 → 1 → 2 → 3 → 0 순환
yield return new WaitForSeconds(0.5f); // 0.5초 간격으로 변경
}
}
}