Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Help Wanted Scene management in MLAPI

Discussion in 'Netcode for GameObjects' started by Lazy_Evaluation, May 3, 2021.

  1. Lazy_Evaluation

    Lazy_Evaluation

    Joined:
    Nov 16, 2019
    Posts:
    7
    Hello guys! I'm beginning to learn MLAPI, from documentation and youtube tutorials.
    I'm confused about scene management. I know that there's a network switch scene method to switch scene between all clients, but how do I switch scene in a single client?
    Let's say, for example, that my multiplayer game has three levels, each in in own scene, and a door connects the scenes. In singleplayer, I would change scene via SceneManager.LoadScene. But how do I do it with MLAPI? I guess I have to change scene and spawn the other players prefab that are in this scene.

    Second question, this should be easier: how do I change scene after connecting/beginning the host process? I need to switch from my menu to my game scene.
    Thanks guys <3
     
  2. cosminunity

    cosminunity

    Unity Technologies

    Joined:
    Mar 4, 2021
    Posts:
    5
    Hi @Lazy_Evaluation,

    To switch the scene on a client, you would normally need to use the SceneManager API of Unity, I think a great reference to look at for doing what you are looking for is one of our Bitesize Samples called Invaders which features a Lobby + join in progress and more, by having a trivial Finite State Machine that handles the scene that you are in.

    For more information, please check out our DOCS here and the GitHub Repo for Invaders and other Bitesize samples

    Let me know if this helps you!

    With that being said more updates will come to MLAPI around SceneManagement so stay tuned! And not to worry, we will update our Docs and Samples to reflect those changes!

    Cheers,
    Cosmin
     
  3. mishakozlov74

    mishakozlov74

    Joined:
    Aug 8, 2018
    Posts:
    74

    Hey, I got a quite similar question, so I decided to ask here instead of creating a new thread.

    I read DOCS and it seems that MLAPI is more about cooperative games rather then MMO, am I right?

    I don't see a way to have different locations with different branch of players on it (which is quite common for MMO games).

    If I am wrong, I kindly ask you to explain the strategy for implementing that.

    I need a few common locations for players and locations like "home" where only local player can be.

    Actually, I can't imagine it being possible, since server is unity application and unity can have multiple scenes only with Adaptive mode, which is not suitable for different locations.

    And I see that you have SceneManagement update in Roadmap, is it relevant to this scenario?
     
    FinleyOderSo likes this.
  4. Picaresque

    Picaresque

    Joined:
    May 8, 2021
    Posts:
    1
    I have a similar question. I want to know how to let one player to change a scene (let's say, he wants to open settings scene, market scene, etc), but at the same time I want the player object to stay in the game and when the player returns back to the main game scene, I want him to be able to control his player object. How can I implement this? Shall I use a SceneManager or a NetworkSceneManager?
    (I am new to unity and MLAPI)
     
  5. mishakozlov74

    mishakozlov74

    Joined:
    Aug 8, 2018
    Posts:
    74

    Yes, you can. I implemented it quite easy with custom interest management.

    Check HideNetwork method (or something like that).

    But eventually I dropped this solution, because you lose authority, which is important for me.

    However, market or settings can be implemented without that, user load them only on client, I assume.
     
    Picaresque likes this.
unityunity