fix(NetworkManager): Move networkAddress check up in StartClient

- If we're going to abort for this, do it before setting anything up.
- If/when the networkAddress is later set, we won't have issue with double initilization when StartClient is called again.
This commit is contained in:
MrGadget1024 2023-11-24 18:03:05 -05:00
parent dfec9a713e
commit 11dc4a9f60

View File

@ -404,6 +404,12 @@ public void StartClient()
return;
}
if (string.IsNullOrWhiteSpace(networkAddress))
{
Debug.LogError("Must set the Network Address field in the manager");
return;
}
mode = NetworkManagerMode.ClientOnly;
SetupClient();
@ -413,13 +419,6 @@ public void StartClient()
RegisterClientMessages();
if (string.IsNullOrWhiteSpace(networkAddress))
{
Debug.LogError("Must set the Network Address field in the manager");
return;
}
// Debug.Log($"NetworkManager StartClient address:{networkAddress}");
NetworkClient.Connect(networkAddress);
OnStartClient();