Is it possible to use LoadLevelAsync and then wait?

Hello,

So what I want to do is to load a level in the background. However I don’t want the actual switch to happen until I specify. Is this possible? Currently LoadLevelAsync switches as soon as the level has been loaded.

This is for Android/iOS so we’re not using streaming.

Thanks.

If you need more info just give me a shout.

You can control the activation scene with the latest Unity, all you have to do is

AsyncOperation op = Application.LoadLevelAsync ( "ExampleScene" );
op.allowSceneActivation = false;

When you need to activate the scene, use this

op.allowSceneActivation = true;

no you cannot do it, but since you are obviously using the pro version, what you can do is to create an assetbundle of your scene. In this way you can load the assetbundle asynchronously, then wait, then use Application.LoadLevel (which will be instantaneous because the data is all loaded).

Here’s a working example for a Loading Screen - the loading bar updates as the scehe is loading, then devices that load in 2.5s+ will open the new scene instantly while faster devices will wait for the timer to count down before opening the scene.

IEnumerator LoadAsynchronously(string levelName) {

        float timer = 0f;
        float minLoadTime = 2.5f;

        AsyncOperation operation = SceneManager.LoadSceneAsync(levelName);
        operation.allowSceneActivation = false;

        while (!operation.isDone) {
            float progress = Mathf.Clamp01(operation.progress / 0.9f);
            loadingBar.value = progress;
            timer += Time.deltaTime;

            if (timer > minLoadTime)
            {
                operation.allowSceneActivation = true;
            }

            yield return null;
        }

        yield return null;

    }