Managing data in scene initialization and ecs worlds

Hey everyone!

I’ve been trying to figure out how to manage data in the initialization of scenes while keeping in mind that we are in ECS for certain parts of our game. Just to give some context, after trial and error, I figured it’s better to see our game as monobehaviour until its not. For me, this means that I would like to have an initialization architecture thats pretty much fully mono, but can also handle the creation of ecs worlds, connection to relay/lobby when it is needed.

For example, the main menu, settings, credits, etc. are all fully mono no ecs. However, when the player clicks on ‘Host game’, the initialization of the lobby scene needs to create both the client and server world to connect them to the lobby. The other way around, when someone joins a lobby, they will only have to create a client world and connect to the host so there is some context to those different cases, but very little change in the logic.

There is also the fact that there might be some data the player setups before actually hosting the game in the main menu that needs to be passed to the lobby (although that may not be necessary).

I have tried the ‘scene initiator’ architecture where I keep a single game object inside the scene (really nothing else is in the scenes initially) and that GO holds all the initialization logic of that scene and I might go with that, but I am really curious to see other ways to handle that especially when using Netcode for entities.

So I guess that my question is pretty much: “Does anyone have examples or tips on a scene initialization architecture with netcode for entities?”

Thanks a lot for your help!