diff --git a/Assets/Mirror/Runtime/NetworkClient.cs b/Assets/Mirror/Runtime/NetworkClient.cs index b057baa52..2f25cfe43 100644 --- a/Assets/Mirror/Runtime/NetworkClient.cs +++ b/Assets/Mirror/Runtime/NetworkClient.cs @@ -27,7 +27,7 @@ public class NetworkClient internal static ConnectState connectState = ConnectState.None; - public static string serverIp { get; internal set; } = ""; + public static string serverIp => connection.address; // active is true while a client is connecting/connected // (= while the network is active) @@ -49,22 +49,20 @@ internal static void SetHandlers(NetworkConnection conn) } // connect remote - public static void Connect(string ip) + public static void Connect(string address) { - if (LogFilter.Debug) Debug.Log("Client Connect: " + ip); + if (LogFilter.Debug) Debug.Log("Client Connect: " + address); active = true; RegisterSystemHandlers(false); Transport.activeTransport.enabled = true; InitializeTransportHandlers(); - serverIp = ip; - connectState = ConnectState.Connecting; - Transport.activeTransport.ClientConnect(ip); + Transport.activeTransport.ClientConnect(address); // setup all the handlers - connection = new NetworkConnection(serverIp, 0); + connection = new NetworkConnection(address, 0); connection.SetHandlers(handlers); }