I have a top down dungeon crawler in 3D where I show one room at a time. Each room is it's own unity scene. Each room has an exit point that when clicked I fade the screen, load a new scene and then fade in the screen. What I'd like to do, but not sure how, is to pre-load the next possible scenes (note the S, there will be 2 but could be more. 2 because it's the next room or the previous if the player decides to go back) while in one scene. I know the scenes that are possible to get to, but how can I pre-load but not show them and because there is more than 2, I assume if they go in one direction, there is a pre-loaded one that I need to unload. Overall I want to do this to make a faster/smoother transition between rooms, but I want the one room at a time for artistic style.
Parent everything in each room's scene to one (or a few) root GameObject(s) that can serve as a point of reference for the room as a whole.
Place a script on these roots with an
Awake()method that switches off its own GameObject using
gameObject.SetActive(false);- Now as soon as the room is loaded, it will disable its own rendering & gameplay before it has a chance to affect anything or appear on screen.
When it's time to show that room, re-enable its root object(s) with
Awakemethods can register them with the corresponding exit points from the main room, so they're easy to find when you need to show them or unload them.