SceneManager.LoadSceneAsync loading scene before allowSceneActivation

The title describes what’s happening.
my code:

async = SceneManager.LoadSceneAsync(2);
async.allowSceneActivation = false;

I think that my scene “2” is so light, that unity loads it before the async.allowSceneActivation = false;
get read. (i’m using the same async variable to store all my AsyncOperations (Menu → Game → Empty scene))

Someone can help me plz?

I dont think that scene can be loaded that faster than the next line code executes. Add Debug.Log(async.progress) after async = SceneManager.LoadSceneAsync(2); to check the progress. It should print 0.

Okay I investigated and I guarantee that the whole method (which SceneManager.LoadSceneAsync is called) will be executed since SceneManager.LoadSceneAsync() waits until next frame.

Where do you execute it? If I remember correctly, async loading is only working in the build.

is it a "lag behind" behaviour or constantly losing distance?

1 Answer

1

Derp, Found the problem xD
another random script is using Application.LoadLevel(2); before the async.
Thx everyone :smiley:

Definitely lag behind.