- Home /
How do I preload multiple scenes at once?
I have a hub world, and when I get close to a new area I'd like to preload the scene for it.
Sometimes I'd like to preload multiple scenes, like if I am in a small town that has multiple buildings the player can go into.
Looking at the existing questions and answers online, I have started digging into using Addressables.LoadSceneAsync
to preload my scenes when a player gets close to a new area, and then activating the async loaded scene when the player enters one of the new areas. When a player gets far away, I would like to use something like Addressables.Release
to free the pre-loaded scene that is no longer likely to get used.
I am blocked because it seems like there is a big limitation (or documented bug?) in Addressables
though: if SceneInstance.allowSceneActivation
is false
, then Addressables
is blocked from loading anything else. This is stated in the documentation here but the reason is not elaborated on:
When allowSceneActivation is set to false then progress is stopped at 0.9. The isDone is then maintained at false. When allowSceneActivation is set to true isDone can complete. While isDone is false, the AsyncOperation queue is stalled. For example, if a LoadSceneAsync.allowSceneActivation is set to false, and another AsyncOperation (e.g. SceneManager.UnloadSceneAsync ) is initialized, the last operation will not be called before the first allowSceneActivation is set to true.
With this limitation, is it possible to accomplish my goal of preloading multiple scenes at once?
If it is not possible, can this limitation be eliminated somehow?
Thanks for your input.