adding check before telling clients (#2010)

* adding check before telling clients

* Update Assets/Mirror/Runtime/NetworkManager.cs

Co-authored-by: MrGadget <chris@clevertech.net>
This commit is contained in:
James Frowen 2020-06-16 17:21:57 +01:00 committed by GitHub
parent 76d49c1e99
commit 8c1ed40c40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -824,8 +824,13 @@ public virtual void ServerChangeScene(string newSceneName)
loadingSceneAsync = SceneManager.LoadSceneAsync(newSceneName);
// notify all clients about the new scene
NetworkServer.SendToAll(new SceneMessage { sceneName = newSceneName });
// ServerChangeScene can be called when stopping the server
// when this happens the server is not active so does not need to tell clients about the change
if (NetworkServer.active)
{
// notify all clients about the new scene
NetworkServer.SendToAll(new SceneMessage { sceneName = newSceneName });
}
startPositionIndex = 0;
startPositions.Clear();