public IEnumerator LoadLevel()
{
// Load into an empty scene
SceneManager.LoadScene("EmptySene", LoadSceneMode.Single);
// Asychronously load in our new scene
asyncLoad = SceneManager.LoadSceneAsync("NextScene", LoadSceneMode.Additive);
asyncLoad.allowSceneActivation = false;
// Wait until scene has finished loading
while (!asyncLoad.isDone) {
yield return new WaitForEndOfFrame
(); }
// NGUI specific call to release unused assets
UIDrawCall.ReleaseInactive();
// Unload any unused assets here and then allow our scene to load
yield return Resources.UnloadUnusedAssets();
asyncLoad.allowSceneActivation = true;
}