FinishLoadScene uses new NetworkManager.mode. This way the host connection doesn't need to be connected before changing host server's online scene. This makes everything easier.

This commit is contained in:
vis2k 2020-01-06 12:34:39 +01:00
commit 3eb11c9a2d

View File

@ -502,8 +502,7 @@ public virtual void StartHost()
// is called after the server is actually properly started.
OnStartHost();
// ConnectHost needs to be called BEFORE server changes scene.
// otherwise FinishLoadScene doesn't know that we are in host mode.
// TODO move this into FinishStartHost! (and test if it still works)
//
// ConnectHost needs to be called BEFORE SpawnObjects:
// https://github.com/vis2k/Mirror/pull/1249/
@ -915,17 +914,17 @@ void FinishLoadScene()
Transport.activeTransport.enabled = true;
// host mode?
if (NetworkClient.active && NetworkServer.active)
if (mode == NetworkManagerMode.Host)
{
FinishLoadSceneHost();
}
// server-only mode?
else if (NetworkServer.active)
else if (mode == NetworkManagerMode.ServerOnly)
{
FinishLoadSceneServerOnly();
}
// client-only mode?
else if (NetworkClient.active)
else if (mode == NetworkManagerMode.ClientOnly)
{
FinishLoadSceneClientOnly();
}