How to stack LoadLevelAsync and multiple LoadLevelAdditiveAsync?

Hello there.

I’m trying to make a loading scene for my game. The game have a MainMenu scene, a Game scene which contain the mail game mechanics and multiple Levelxx scenes which contains the levels assets.

I want to load both the Game and Levelxx scene asynchroneously, but I’m having quite a problem.

The main idea is to have :

void Start()
{
    Application.LoadLevelAsync("Game");
    Application.LoadLevelAdditiveAsync("Levelxx");
}

The issue is, when LoadLevelAsync finish its work, it change level immediately before calling LoadLevelAdditiveAsync. Fine. I’ll wait for it to finish working.

IEnumerator Start()
{
    ASyncOperation gameLoad = Application.LoadLevelAsync("Game");
    gameLoad.allowSceneActivation = false;
    ASyncOperation levelLoad = Application.LoadLevelAdditiveAsync("Levelxx");
    yield return levelLoad ;
    gameLoad.allowSceneActivation = true;
}

This seems fine at first glance BUT the LoadLevelAdditiveAsync can’t load until the previously AsyncOperation is done, but it will never get done as I allow it after the LoadLevelAdditiveAsync is itself done, the scene loading just never end.

In all, I can’t find how I can load a level separated into multiple scenes with the async ops. Anyone know of a way to get it to work?

I’ve found a simple solution.

I use only LoadLevelAdditiveAsync for both my Game scene and Levelxx scene.

public static IsDone { get; private set; }
IEnumerator Start()
{
	IsDone= false;

	m_sceneLoading = Application.LoadLevelAdditiveAsync(s_sceneToLoad);
	yield return m_sceneLoading;

	m_levelLoading = Application.LoadLevelAdditiveAsync("Levelxx");
	yield return m_levelLoading;

	IsDone = true;
	gameObject.SetActive(false);
}

And that way, all my objects are imported in the same scene without skip.

If I want to delay the Start() functions of my imported object, I change their void Start() functions to

IEnumerator Start()
{
	while(!SceneLoader.IsDone)
	{
		yield return null;
	}
	
	// Doing start stuff
	
}