Best design for instant loading of sub games

Hi All,

just starting to lean unity and c#, though have a lot of c/c++ experience and some low level 3d graphics experience.

What I’d like to do is write a game that uses lots of mini games, each mini game is based on a set of themes, the usual stuff, space, tropical island etc. I’d like these to load instanly after the first load of the game.

I have just started unity and am trying to work out the best way of doing things. The way I though was

  1. Have a central bub, this is where the player enters and where the game loads. This has doors that lead to space, island , Arctic, etc.

  2. When the player enters say space, it does a min scene load, only a tiny amount of graphics, to illustrate the scene. The player then walks over to a door to open a mini game.

  3. when the player enters the say space hub, I load the 5 mini games into the background. While the player has to run over to a door to open. This means the mini games appears to be already running when the player enters.

The way I though I’d do this is to do a LoadScene at start up to load central hub. Then LoadScene loading in min graphics for the area hub. Then use LoadSceneAsync to load every mini game while player is in area hub, and use SetActiveSceneas player enters door. When player leaves area I unload each scene. Is this the best way to do things?

I’ve read that LoadSceneAsync flips to scene straight away when loaded? On a question on this sub. Can I use it to load multiple scenes then flip to anyone when I’m ready? Rather than it forcing the flip when it’s loaded?

Are there any assets on the store I can use to make loading speed up, I’d like it to be as fast as possible, eg fast scene or texture loading? I was looking at Alas magick and Amplify texture 2?. Is there any asset that can keep track of open and closed scenes, or am I better off doing this myself? Thanks.

In your case what I’d is keep one magement scene as your “overseer” and then use SceneManager.LoadScene Async with LoadSceneMode parameter set to “Additive”. This will not kill your current scene nor will it make the primary one. It will simply load it and add it to the current scene. Make sure the art does not overlap in scene view and you’re good to go.

Amplify texture 2 will decrease your performance quite noticeably as it uses a second camera that draws everything to calculate where to load what resolution of texture. This is CPU sacrifice in exchange of memory, not performance. The best thing you can do to speed up loading is yourself manage textures with low res and high res versions of them. Lets say you load Scene A with all materials with a 64x64 texture applied to them. Then each frame for a couple of seconds load all the higher res versions of the textures. That’s lean, ascync and efficient.

In our game (Kona), our scenes are huge, but the hiccups are not so bad and we’re not doing the texture swap thing as it’s too late. So I guess if your game is simple, you shouldn’t notice any hiccup and the loading should be quite instant.

1 Like

If you need this much control I would suggest abandoning scenes. There are a bunch of tricks then available to you.

  • Always loading. When ever you have spare cycles and memory you can be loading and unloading
  • Partial loading. Transitions can appear faster if you load geometry first, then textures later.
1 Like

I partially agree with the above, but keep in mind that if you need anything like Enlighten GI, Occlusion Culling or lightmaps, don’t abandon scenes.

1 Like

Thanks All.