Unity 简单的异步加载场景
作者:
U3D界金城武 | 来源:发表于
2017-03-06 11:34 被阅读968次AsyncOperation async; //定义异步加载
void Start () {
StartCoroutine(SceneLoad());
}
IEnumerator SceneLoad()
{
async = SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex + 1);//下一个加载场景
async.allowSceneActivation = false;//场景暂时不进入
yield return async;
}
//激活场景
public void ActivatedScene()
{
async.allowSceneActivation = true;
}
//需要加载的时候
GetComponent<sceneCG>().ActivatedScene();
本文标题:Unity 简单的异步加载场景
本文链接:https://www.haomeiwen.com/subject/lugygttx.html
网友评论