diff --git a/Assets/Mirror/Core/HostMode.cs b/Assets/Mirror/Core/HostMode.cs index 0b2d8b35d..e5bb2c056 100644 --- a/Assets/Mirror/Core/HostMode.cs +++ b/Assets/Mirror/Core/HostMode.cs @@ -1,6 +1,8 @@ // host mode related helper functions. // usually they set up both server & client. // it's cleaner to keep them in one place, instead of only in server / client. +using System; + namespace Mirror { public static class HostMode @@ -39,19 +41,8 @@ public static void InvokeOnConnected() ((LocalConnectionToServer)NetworkClient.connection).QueueConnectedEvent(); } - // calls OnStartClient for all SERVER objects in host mode once. - // client doesn't get spawn messages for those, so need to call manually. - // public because NetworkServer.ActivateHostScene was public before too. - public static void ActivateHostScene() - { - foreach (NetworkIdentity identity in NetworkServer.spawned.Values) - { - if (!identity.isClient) - { - // Debug.Log($"ActivateHostScene {identity.netId} {identity}"); - NetworkClient.CheckForStartClient(identity); - } - } - } + // DEPRECATED 2023-01-28 + [Obsolete("ActivateHostScene did nothing, since identities all had .isClient set in NetworkServer.SpawnObjects.")] + public static void ActivateHostScene() {} } } diff --git a/Assets/Mirror/Core/NetworkManager.cs b/Assets/Mirror/Core/NetworkManager.cs index 270bc9b55..5b536958f 100644 --- a/Assets/Mirror/Core/NetworkManager.cs +++ b/Assets/Mirror/Core/NetworkManager.cs @@ -523,7 +523,6 @@ void FinishStartHost() SetupClient(); networkAddress = "localhost"; - HostMode.ActivateHostScene(); RegisterClientMessages(); // call OnConencted needs to be called AFTER RegisterClientMessages diff --git a/Assets/Mirror/Tests/Editor/NetworkServerTest.cs b/Assets/Mirror/Tests/Editor/NetworkServerTest.cs index 5642f6611..0f6d5b90f 100644 --- a/Assets/Mirror/Tests/Editor/NetworkServerTest.cs +++ b/Assets/Mirror/Tests/Editor/NetworkServerTest.cs @@ -839,28 +839,6 @@ public void SendCommand_RequiresAuthority() Assert.That(comp.called, Is.EqualTo(0)); } - [Test] - public void ActivateHostSceneCallsOnStartClient() - { - // listen & connect - NetworkServer.Listen(1); - ConnectClientBlockingAuthenticatedAndReady(out _); - - // spawn identity with a networkbehaviour. - // (needs to be in .spawned for ActivateHostScene) - CreateNetworkedAndSpawn( - out _, out NetworkIdentity serverIdentity, out OnStartClientTestNetworkBehaviour serverComp, - out _, out _, out _); - - // ActivateHostScene calls OnStartClient for spawned objects where - // isClient is still false. set it to false first. - serverIdentity.isClient = false; - HostMode.ActivateHostScene(); - - // was OnStartClient called for all .spawned networkidentities? - Assert.That(serverComp.called, Is.EqualTo(1)); - } - [Test] public void SendToAll() {