untiy吧 关注:161贴子:158
  • 2回复贴,共1

关于Unity异步加载场景的问题

只看楼主收藏回复

AsyncOperation.progress由0直接到0.9,当时进度条加载结束时却不能立刻进入场景,有大神知道怎么破吗?
private IEnumerator StartLoading(int scene, float deltaTime) {
yield return new WaitForSeconds ( deltaTime );
int displayProgress = 0;
int toProgress = 0;
AsyncOperation op = Application.LoadLevelAsync(scene);
op.allowSceneActivation = false;
while(op.progress < 0.9f) {
toProgress = (int)op.progress * 100;
while(displayProgress < toProgress) {
++displayProgress;
SetLoadingPercentage(displayProgress);
yield return new WaitForEndOfFrame();
}
}
toProgress = 100;
while(displayProgress < toProgress){
++displayProgress;
SetLoadingPercentage(displayProgress);
yield return new WaitForEndOfFrame();
}
op.allowSceneActivation = true;
}


IP属地:广东1楼2016-09-21 20:20回复
    哥们,这问题解决了吗?


    IP属地:湖北2楼2016-12-21 10:17
    收起回复