mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
fix: Don't call RegisterClientMessages every scene change (#1865)
This commit is contained in:
parent
a245e37a28
commit
05c119f505
@ -995,19 +995,14 @@ void FinishLoadSceneHost()
|
||||
// call OnServerSceneChanged
|
||||
OnServerSceneChanged(networkSceneName);
|
||||
|
||||
if (NetworkClient.isConnected)
|
||||
{
|
||||
RegisterClientMessages();
|
||||
|
||||
// DO NOT call OnClientSceneChanged here.
|
||||
// the scene change happened because StartHost loaded the
|
||||
// server's online scene. it has nothing to do with the client.
|
||||
// this was not meant as a client scene load, so don't call it.
|
||||
//
|
||||
// otherwise AddPlayer would be called twice:
|
||||
// -> once for client OnConnected
|
||||
// -> once in OnClientSceneChanged
|
||||
}
|
||||
// DO NOT call OnClientSceneChanged here.
|
||||
// the scene change happened because StartHost loaded the
|
||||
// server's online scene. it has nothing to do with the client.
|
||||
// this was not meant as a client scene load, so don't call it.
|
||||
//
|
||||
// otherwise AddPlayer would be called twice:
|
||||
// -> once for client OnConnected
|
||||
// -> once in OnClientSceneChanged
|
||||
}
|
||||
// otherwise we just changed a scene in host mode
|
||||
else
|
||||
@ -1020,8 +1015,6 @@ void FinishLoadSceneHost()
|
||||
|
||||
if (NetworkClient.isConnected)
|
||||
{
|
||||
RegisterClientMessages();
|
||||
|
||||
// let client know that we changed scene
|
||||
OnClientSceneChanged(NetworkClient.connection);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user