From e0ffc66be8412f168a6ddf8cc5a041e3057ede9a Mon Sep 17 00:00:00 2001 From: vis2k Date: Mon, 12 Dec 2022 13:53:07 +0100 Subject: [PATCH] NetworkClient.ConnectHost: local connection setup moved into a separate function --- Assets/Mirror/Core/NetworkClient.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Assets/Mirror/Core/NetworkClient.cs b/Assets/Mirror/Core/NetworkClient.cs index ad7900a3d..ebbb9481e 100644 --- a/Assets/Mirror/Core/NetworkClient.cs +++ b/Assets/Mirror/Core/NetworkClient.cs @@ -212,14 +212,10 @@ public static void Connect(Uri uri) connection = new NetworkConnectionToServer(); } - // TODO why are there two connect host methods? - // called from NetworkManager.FinishStartHost() - public static void ConnectHost() + // keep the local connections setup in one function. + // makes host setup easier to follow. + internal static void SetupHostConnections() { - Initialize(true); - - connectState = ConnectState.Connected; - // create local connections pair, both are connected Utils.CreateLocalConnections( out LocalConnectionToClient connectionToClient, @@ -231,6 +227,15 @@ public static void ConnectHost() NetworkServer.SetLocalConnection(connectionToClient); } + // TODO why are there two connect host methods? + // called from NetworkManager.FinishStartHost() + public static void ConnectHost() + { + Initialize(true); + connectState = ConnectState.Connected; + SetupHostConnections(); + } + /// Connect host mode // called from NetworkManager.FinishStartHostClient // TODO why are there two connect host methods?