so it’s not possible to load the scene in inactive state then control its activation
solution:
then
documentation is bad so I had to dig in the
time to update the docu, don’t you think…
I’m not seeing what’s wrong with the docs here? allowSceneActivation is for the SceneManager API. Your solution is exactly what that doc mentions for the Addressables API.
Adding
loadAsync.Result.ActivateAsync();
did not help for me. Could you elaborate on this a bit?
In 2024 I still cannot load a scene in background and not activate it with Addressables…activateOnLoad=false simply does not work
1 Like
I manage to load and activate it like this:
private string sceneToLoad = "scene";
private void LoadScene()
{
Addressables.LoadSceneAsync(this.sceneToLoad, LoadSceneMode.Additive, false).Completed += this.OnSceneLoaded;
}
private void OnSceneLoaded(AsyncOperationHandle<SceneInstance> obj)
{
if (obj.Status != AsyncOperationStatus.Succeeded)
{
return;
}
obj.Result.ActivateAsync().completed += this.OnSceneActivated;
}
private void OnSceneActivated(AsyncOperation obj)
{
Scene sceneToActivate = SceneManager.GetSceneByName(this.sceneToLoad);
SceneManager.SetActiveScene(sceneToActivate);
}