๊ตฌ๊ธ์์ ์ฐพ์ ๋ก๋ฉํ๋ฉดย ์์ ๋ฏ์ด๋ณด๊ณ ์ง์ ๋ง๋ค์ด๋ณด๋๋ฐ ์๊พธ ๋ฒ๊ทธ๊ฐ ํด๊ฒฐ์ด ์๋๋ค ใ ใ
IEnumerator LoadScene()
{
AsyncOperation asyncLoading = SceneManager.LoadSceneAsync(SceneName);
asyncLoading.allowSceneActivation = false;
Debug.Log(SceneName + "ํ์ค");
while (!asyncLoading.isDone)
{
yield return null;
if (asyncLoading.progress < 0.9f)
{
ProgressPercent = asyncLoading.progress;
Debug.Log("< 0.9 ์ถ๋ ฅ๋๋ ํผ์ผํธ๊ฐ" + ProgressPercent);
}
else
{
Timer += Time.unscaledDeltaTime;
ProgressPercent = Mathf.Lerp(0.9f, 1f, Timer/5);
Debug.Log(Timer + "time ๊ฐ");
if (ProgressPercent >=1f)
{
asyncLoading.allowSceneActivation = true;
yield break;
}
}
string ProgressPercentText = Mathf.Floor((ProgressPercent * 100)).ToString();
Progress.text = ProgressPercentText + "%";
Debug.Log(ProgressPercent + "์ถ๋ ฅ๋๋ ํผ์ผํธ ๊ฐ");
}
}
๊ทธ๋ฆฌ๊ณ ๋๊ฐ ์ด๋ฐ์์ด๊ณ 90ํผ ์ดํ ๋ก๋ฉ๋๋ ๋ถ๋ถ์์ ๋ก๋ฉ๋ฐ ํผ์ผํธ๊ฐ ์์ฌ๋ผ๊ฐ
๋ก๊ทธ์๋ ๋ญ๋ผ๊ณ ์ฐํ๋๋ฐ?
์ปดํจํฐ๋ ๋นจ๋ผ์ if (asyncLoading.progress < 0.9f){ProgressPercent = asyncLoading.progress;Debug.Log("< 0.9 ์ถ๋ ฅ๋๋ ํผ์ผํธ๊ฐ" + ProgressPercent);์ด์ชฝ๋ถ๋ถ์ ๋ฐ๋ก 0.9์ฐ๊ณ ๋๋๊ณ ํธ๋ํฐ ์์ ์ผ์ด๋๋๋ฐํธ๋ํฐ ๋ก๊ทธ๋ ์ด๋ป๊ฒ ๋ณด๋์ง ๋ชฐ๋ผ์ ๋ชป๋ดฃ์
๊ทธ๋ฅ ์๊ฐ๋๋๋ฌธ์ ๊ตณ๋๊ฑฐ ๊ฐ๊ธดํ๋๋ฐ ๋์ค์ ๋ค์ ๋ณด๋ ค๊ตฌ ๋ต๋ณ๊ณ ๋ง์ ใ ใ
ํด๊ฒฐํ๋ค ๊ทผ๋ฐ ์ด์ ๋ฅผ ๋ชจ๋ฅด๊ฒ ์ ใ ใ