0
点赞
收藏
分享

微信扫一扫

场景过渡进度条

舍予兄 2023-02-03 阅读 34


private void Start()
{
LoadAScene();
}

public void LoadAScene()
{
StartCoroutine(LoadSceneAsync("SceneLogin"));
}

IEnumerator LoadSceneAsync(string sceneName)
{
AsyncOperation operation = SceneManager.LoadSceneAsync(sceneName);
operation.allowSceneActivation = false;
while (!operation.isDone)
{
#if UNITY_EDITOR
Debug.Log("Progress is :" + operation.progress);
#endif
float progress = Mathf.Clamp01(operation.progress / 0.9f);
progressBar.fillAmount = progress;
loadText.text = ((int)progress * 100).ToString() + "%";
yield return null;
if (progressBar.fillAmount >= 0.85)
{
Debug.Log("跳出协程");
yield break;
}
}
operation.allowSceneActivation = true;
}


举报

相关推荐

进度条3

Android进度条

进度条效果

进度条 参考

进度条seekbar

打印进度条

0 条评论