NetworkManager: SetupClient() for consistency with SetupServer()

This commit is contained in:
vis2k 2022-10-03 08:49:06 +02:00
parent d4b1239dc4
commit 4fbbc0cbc1

View File

@ -304,6 +304,20 @@ public void StartServer()
}
}
void SetupClient()
{
InitializeSingleton();
if (runInBackground)
Application.runInBackground = true;
if (authenticator != null)
{
authenticator.OnStartClient();
authenticator.OnClientAuthenticated.AddListener(OnClientAuthenticated);
}
}
/// <summary>Starts the client, connects it to the server with networkAddress.</summary>
public void StartClient()
{
@ -315,16 +329,7 @@ public void StartClient()
mode = NetworkManagerMode.ClientOnly;
InitializeSingleton();
if (runInBackground)
Application.runInBackground = true;
if (authenticator != null)
{
authenticator.OnStartClient();
authenticator.OnClientAuthenticated.AddListener(OnClientAuthenticated);
}
SetupClient();
// In case this is a headless client...
ConfigureHeadlessFrameRate();
@ -354,16 +359,7 @@ public void StartClient(Uri uri)
mode = NetworkManagerMode.ClientOnly;
InitializeSingleton();
if (runInBackground)
Application.runInBackground = true;
if (authenticator != null)
{
authenticator.OnStartClient();
authenticator.OnClientAuthenticated.AddListener(OnClientAuthenticated);
}
SetupClient();
RegisterClientMessages();
@ -486,11 +482,7 @@ void StartHostClient()
{
//Debug.Log("NetworkManager ConnectLocalClient");
if (authenticator != null)
{
authenticator.OnStartClient();
authenticator.OnClientAuthenticated.AddListener(OnClientAuthenticated);
}
SetupClient();
networkAddress = "localhost";
NetworkServer.ActivateHostScene();