LoadLevelAsync and load data before allowSceneActivation

HI

I was wondering if it is possible to load data before the scene has finished loading.

I have a menu-scene and if the player hits a button I want to load my game scene and also load data. To load the data I plan to use whydoidoit’s Unity Serializer ( I didn’t implement that yet).
If the button is hit I display a “loading screen” but I don’t want it to disappear when the new scene is loading since the deserialization will take some time too.

What I quickly tried (and is not logical at all) is:

  1. Start loading the scene by calling LoadLevelAsync from a singleton class that is not destroyed on load
  2. set the allowSceneActivation flag to false
  3. From a script in the new scene I tried to call a function in the singleton class to set allowSceneActivation to true

As you can imagine at point 3 I cannot execute any code from the new scene before it has finished loading. Or can I?
I’d be surprised if its possible using this method.

Now how can I solve this problem?

Or is there a possibility built in the Unity Serializer?

Thanks

I just didn’t think enough.

I now have the UI (containing the loading screen) not destroying on load too and destroy it after everything is loaded.

facepalm :slight_smile: