If I connect to a game, Then disconnect from it and try to connect again, the in-scene network objects won’t spawn again. This is my disconnection code:
try
{
if (NetworkManager.Singleton.IsServer)
{
await LobbyService.Instance.DeleteLobbyAsync(lobby.Id);
}
else
{
await LobbyService.Instance.RemovePlayerAsync(lobby.Id, playerId);
}
Debug.Log("sucssefully dissconected from lobby");
//shutdown
try
{
NetworkManager.Shutdown();
NetworkManager networkManager = GameObject.FindObjectOfType<NetworkManager>();
Destroy(networkManager.gameObject);
Debug.Log("Network manager was shut down succesfuly");
}
catch
{
Debug.Log("Network manager already shut down");
}
}
catch (LobbyServiceException e)
{
Debug.Log(e);
}
SceneManager.LoadScene(0);