I am reading Netcode for GameObjects 1.0.0 documentation and I found this example: https://docs-multiplayer.unity3d.com/docs/components/networkmanager/ (Disconnect section). I am trying to make disconnect button, but it seems like this example is outdated and I can’t find how to Stop the Host or Client. What is the current method of doing this?
public void Leave()
{
if (NetworkManager.Singleton.IsHost)
{
NetworkManager.Singleton.StopHost();
NetworkManager.Singleton.ConnectionApprovalCallback -= ApprovalCheck;
}
else if (NetworkManager.Singleton.IsClient)
{
NetworkManager.Singleton.StopClient();
}
connectionPannel.SetActive(true);
leaveButton.SetActive(false);
}
Removed NetworkManager’s StopServer(), StopClient() and StopHost() methods and replaced with single NetworkManager.Shutdown() method for all (#1108)
I’ve replaced the methods with the Shutdown() method, now when a client disconnects, client-owned gameobjects are not unspawning automatically. I’m wondering if this is a bug or if I’m just misunderstanding the documentation.
Any help on the spawning issue would be appreciated.