Skip to content

Commit

Permalink
fix: ClientSceneManager should be responsible for its own cleanup (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
uweeby committed Jul 17, 2020
1 parent f44f3c9 commit 92ab3ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 0 additions & 1 deletion Assets/Mirror/Runtime/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ void Cleanup()

ClearSpawners();
DestroyAllClientObjects();
sceneManager.Ready = false;
isSpawnFinished = false;
hostServer = null;

Expand Down
8 changes: 8 additions & 0 deletions Assets/Mirror/Runtime/NetworkSceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void Start()
if (client != null)
{
client.Authenticated.AddListener(OnClientAuthenticated);
client.Disconnected.AddListener(OnClientDisconnected);
}
if (server != null)
{
Expand Down Expand Up @@ -214,6 +215,13 @@ void OnClientAuthenticated(INetworkConnection conn)
logger.Log("NetworkSceneManager.OnClientAuthenticated");
}

void OnClientDisconnected()
{
Ready = false;
client.Authenticated.RemoveListener(OnClientAuthenticated);
client.Disconnected.RemoveListener(OnClientDisconnected);
}

internal void ClientSceneMessage(INetworkConnection conn, SceneMessage msg)
{
if (!client.IsConnected)
Expand Down

0 comments on commit 92ab3ff

Please sign in to comment.