Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

How to disable automatic change scene when client disconnect from a server

Discussion in 'Connected Games' started by LTK, May 9, 2016.

  1. LTK

    LTK

    Joined:
    Jul 16, 2015
    Posts:
    22
    Like a title, How to disable automatic change scene on client?
    I have NetworkLobbyManager, I want, when I Stop a Host then on Client show popup "Disconnect" and button "Ok", press "Ok" to return Lobby Scene
    Sorry, my english grammar is very bad :(
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,268
    You could possibly leave the offline scene on the NetworkManager empty, have an additional variable for your scene and do the transition manually. Haven't tested this though.

    In my case I've wanted to let the players stay in the game, while the game is over and the scores are displayed. This also means that the client objects should not be destroyed, but not receive any updates. Should be quite tricky to get this right and I haven't been able to do so yet.
     
  3. Oshroth

    Oshroth

    Joined:
    Apr 28, 2014
    Posts:
    99
    Have a look at the Networking sourcecode about NetworkMigrationManager and NetworkManager. It stops the clients from returning to the offline scene if a game is still running while it looks for a new host. You would need some extra work to stop it disabling client objects though
     
  4. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    284
    Quite old topic, but seems that the only thread at this forum.
    I used this approach - link , but seems it doesn't work for clients end when server had been disconnected/left the game. In that case client get
    Code (CSharp):
    1. ClientDisconnected due to error: Timeout
    2. UnityEngine.Networking.NetworkLobbyManager:OnClientDisconnect(NetworkConnection)
    lobbyScene/offlineScene set to "" for sure, but somehow getting that message client scene changed back to lobby scene.
    Any ideas why that happens and how to handle that case?