Pre-loading multiple scenes to avoid loading times

Hey,

In Paper Mario games and many others, a given scene will usually have two or more exits leading to other scenes without the need for loading times. I assume this was achieved by pre-loading all the scenes you can reach from a given location so that by the time the player walks to an exit, all that is needed for the scene loader is to be given the green light — since the heavy duty loading was already done in the background.

Now, LoadSceneAsync technically allows for something like that: You load a scene on Start and set its allowSceneActivation to false, meaning it won’t actually activate until you tell it to (by setting allowSceneActivation to true). The problem is, that only works for one scene; you can’t pre-load multiple scenes that way. The documentation insists on that aspect, and when I tried to load multiple scenes anyway Unity flat out crashed. That seems to be a big no-no.

I’m not sure where to look next for a way to load as many scenes as reasonably possible in the background on Start if the SceneManager can’t help. Assistance would greatly appreciated. Cheers!

Nintendo first party games have always been amazing in this no-loading regard.

It takes a lot of work to reach their level.

For one, they keep their level data extremely small, so that loading is effectively instantaneous.

For two, they control ALL the hardware and software, so they’re not (generally) using a generic engine like Unity.

You are almost ALWAYS going to have some type of hiccup, especially if there are big textures that need to come into being at some point in your level.

About the best you can hope for is to constantly test your levels (on the actual hardware!), optimize your level size to be as small as possible, keep multiple scenes in one single scene, preload portions of your next level in clever ways to hide loading, give the user something interesting to do during loads, etc.

Thank you for your response.

The Paper Mario-inspired indie game Bug Fables (which was developed using Unity) did a great job replicating Paper Mario’s seamless scene transition. I’m sure it’s possible to come up with a solution; it’s just that Unity’s built-in solution has that weird limitation where you can’t pre-load more than one scene at once. My project involves fairly lightweight scenes (both objects- and scripts-wise) that load up in a matter of a couple of seconds, so I’m confident this is more of an issue relating to approach than optimization.

Properly designed scenes can be loaded and turned OFF in their entirety, so assuming you can fit 3 scenes in memory at once:

  • enter scene 1
  • additively load scene 2 (one possible exit) and disable all
  • additively load scene 3 (the other possible exit) and disable all

The moment you hit the scene 1 exit and need scene 2 or scene 3:

  • activate the scene you want.
  • unload scene 1
  • unload the other not-used scene
  • start additively loading possible exit scenes

Additive scenes are pretty amazing. Once you start using them, you’ll never go back. Here’s some more blurbs:

Additive scene loading is one possible solution:

A multi-scene loader thingy:

My typical Scene Loader:

Other notes on additive scene loading:

Timing of scene loading:

Also, if something exists only in one scene, DO NOT MAKE A PREFAB out of it. It’s a waste of time and needlessly splits your work between two files, the prefab and the scene, leading to many possible errors and edge cases.

Checking if everything is ready to go:

I had not thought about that! Thanks for the detailed response.

1 Like