我正在创建一个针对Samsung Gear VR的Unity应用程序.我目前有两个场景:
从第一个场景开始,我想在后台加载第二个场景,并在加载后切换到它.当新场景在后台加载时,用户应该保持移动头部以查看VR环境的任何部分的能力.
我正在使用SceneManager.LoadSceneAsync但它不起作用:
// ...
StartCoroutiune(loadScene());
// ...
IEnumerator loadScene(){
AsyncOperation async = SceneManager.LoadAsyncScene("Scene", LoadSceneMode.Single);
async.allowSceneActivation = false;
while(async.progress < 0.9f){
progressText.text = async.progress+"";
}
while(!async.isDone){
yield return null;
}
async.allowSceneActivation = true;
}
Run Code Online (Sandbox Code Playgroud)
使用该代码,场景永远不会改变.
我试过这个典型SceneManager.LoadScene("name")的情况,在这种情况下,场景在30秒后正确变化.