Hello !
Everything is in the title, I want to load my scene asynchonously but in Multiplayer with Netcode for GameObject.
I want to be able to make some clean transition between scene for all my players like GTFO or more recently in Lethal Compagny.
I know how to do it in singleplayer, but I’m completely stuck for the multiplayer aspect…
Have you read the scene management documentation?
The server always loads additive scenes asynchronously, and only one at a time. Meaning you will have to implement your own sequencing if you need to load multiple additive scenes.
Single scene loading is synchronous, and IMO should be avoided altogether in a networked project. I currently work entirely without any single-loaded scenes, just the scene that is first loaded in the build list and from then on every other scene is loaded additively, be it online or offline. This workflow has been the best decision ever as every object you put in the first launch scene will default to be persistent without the DDOL crud.
Thank’s for your answer.
So if I understood clearly, additive scene will always be load asynchronously, and the scene will be activated for all the client whenever it’s completely load.
I don’t really understand the example you gave me with your project, can you re-explain me this please ?
Thank you in advance
I hope my blog post about the reasons behind using only additive scenes helps clarify.
In essence, a major issue occurs in all projects: the lifecycle of objects and their components. These are generally tied to the scene they are in. Single-load another scene and those references are gone.
Instead what I do is to actually prohibit single-scene loading. All content is loaded additively. I need to show the title screen => I additively load the title screen scene. Then I want to show the main menu => I additively load the main menu scene and unload the title screen additive scene. And so on.
Any objects in the “main” scene will persist, they are permanent systems, they never get destroyed, there aren’t any potential race conditions or order of execution issues that are prevalent every time a new single-loaded scene is loaded.
Basically I treat scenes as what they are: “larger prefabs”. You can swap them in and out.