I’m hoping to have a brief cutscene system where it’s practically a static frame with concise story info. I want the player to touch a portal and, ideally, have both the cutscene scene and the next location scene to start loading at the same time, giving the next location as much time to load as possible.
How would I go about loading both new scenes at once, unloading the current scene to display the cutscene while still continuing the next location scene’s loading, and then when the player is done with the cutscene (user input press), it’ll load the next location.
What did you already try and where did you get stuck?
You can load scenes async and communicate by finding components, using static variables, using singletons, or other things.
SceneManager has async load methods. You may also want additive scene loading for this effect, and in general because it provides a better way to work with scenes.
Effectively do a single load of an almost empty scene. That could be your only single-loaded scene in the game really.
The initial content could be nothing more than a “loading” image of sorts that draws on top of everything and is enabled automatically. A script then async loads further additive scenes, and the returned object you can use to check if the scene has finished loading.
Make sure all additive scene content starts out inactive/hidden or simply ensure they draw behind the loading image. Only after all intended scene loads are done you’d disable the loading image and show the rest of the content. That would be your cutscene playing now.
At the same time you’d start async loading next additive scene content and hide it until the cutscene is done. Afterwards you unload the cutscene scenes and show the next content scenes.
My initial thought was to have some ScriptableObject for the next location Scene, load the cutscene, and then have part of the script for the cutscene scene to start loading the next location Scene async. I wanted to optimize on that with my idea above but didn’t know of how to achieve that. All I could think of was loading both async, but I feel unloading the initial location scene would wreck that optimised idea.
Hmm… I hadn’t thought of a container scene to load both the cutscene and the next location scene. I guess I was worried about having aspects of the gameplay happening without control - that I wanted the first location scene to completely unlock, and not have the next location appear until the cutscene was completely, so nothing happened to the player in either situation.