Search Unity

Question Scene Management approach for semi-synced gameplay

Discussion in 'Netcode for GameObjects' started by mishakozlov74, Jan 6, 2023.

  1. mishakozlov74

    mishakozlov74

    Joined:
    Aug 8, 2018
    Posts:
    143
    Hello, I'm working on a cooperative game where players can play levels together.

    There are scenes that I have:
    1. Home (loads on game start)
    2. City
    3. Lobby
    4. Level

    Every player loads Home scene on the game start and can load City scene additively. On both of them they can host a game.

    The thing is, I don't want connecting clients to load City scene too, I want them to stay where they are (whether it's their Home scene or City Scene too).

    So, I tried to prevent it from being loaded using
    Code (CSharp):
    1. NetworkManager.Singleton.SceneManager.VerifySceneBeforeLoading = (_, sceneName, _) => {
    2.      return sceneName != "City";
    3. };
    On both server and client. But it doesn't work. I get this error:



    So, the questions I have
    1. Why locally loaded scene is getting synchronised with clients, even if it was loaded before hosting and not via NetworkSceneManager?
    2. How do I make such structure with some scenes loaded locally and some globally for all the players?

    Thanks.
     

    Attached Files:

  2. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    Hi @mishakozlov74 , your problem seems to be that you're trying to use a custom scene management system without disabling the managed one. Have you already had a look at this?