赞
踩
补课肯定是要打demo的,打的时候发现加载场景的旧方法已经过时了。
现在的加载方法:
using UnityEngine.SceneManagement;
SceneManager.LoadScene(string sceneName);
SceneManager.LoadSceneAsync(string sceneName);
SceneManager.Unloadscene(string sceneName);
private AsyncOperation _asyncOperation = SceneManager.LoadSceneAsync(loadSceneName);
if(_asyncOperation.isDone)
{
Debug.Log("场景加载完成");
}
private void Start()
{
SceneManager.sceneLoaded += Loading;//绑定委托,加载场景的时候会调用此方法
SceneManager.sceneUnloaded += Destroying;//绑定委托,销毁场景的时候会调用此方法
}
private void Loading(Scene scene,LoadSceneMode move)
{
//dosomething
}
private void Destroying(Scene scene)
{
//dosomething
}
注意:异步加载场景的过程中弄进度条地址
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。