Failing to connect to the server

Connecting to server times out and fails to connect.

Everything on UGS appears to be working otherwise. The allocation is allocating but deallocates after a period of time (I assume this is normal.

Hi there,
This is probably a matchmaking issue. The first time you try and connect to a server on a given day, Unity has to allocate a matchmaking server for your game. Try extended the time out time and double check that your matchmaking rules are correct.

This didn’t help. I refreshed the server list while connecting and the server is allocating during that process, but still failing to connect.

Okay, next step is to disable any VPNs and switch from DTLS to UDP.
Let me know if either of those helps!

Ok, no VPN to disable and I switched to UDP in the ClientGameManager.cs. now it times out and says MatchAssignmentError. With the change to udp, the UI text doesn’t switch to say connecting like it did before.

Edit: On the third attempt, it reverted to the same behavior. The Ui says Seaching, then Connecting until finally timing out to a failed to connect to server error


I have attached a screenshot of the error from the server end. I hope this helps.

Okay we see it’s timing out after 120 seconds, can you extend the timeout period in the pool settings?
Change the timeout from 120 to like 360, to give it more leeway.

Everything points to this being caused by not pinging the server frequently enough, but we have it pinging every 100 ms in the course. Or it could be an error with the ping.

In the ServerCheckLoop in the MultiplayAllocationService, you could try reducing the delay from 100 ms to like 50ms and see if that helps.

Another thing which is a long shot, but in BeginServerCheck (in MultiplayAllocationService), we have this line:
serverCheckManager = await multiplayService.StartServerQueryHandlerAsync((ushort)20, "ServerName", "", "0", "");
We could try giving it some string values:
serverCheckManager = await multiplayService.StartServerQueryHandlerAsync((ushort)20, "ServerName", "GameType", "0", "Map");

Let me know if any of that helps, there are several other students having this same problem.

I’m a little confused. Are the pool settings in a script or in UGS?

The pool settings are on the UGS dashboard.

I’m not seeing pool settings.

I found it

1 Like


I set the timeout to 360, but the logs are still showing a time out at 61 seconds.

Darn, I guess try the updates to the multiplay allocation service next.

I’ve tried all three solutions and none worked.

Okay if you would like to upload your project here:
https://gdev.tv/projectupload
I will try and recreate this error and see if I can find a solution.
I can’t find any information about it online, but I will see if someone has encountered it on the Unity Netcode Discord.

What version of Unity and Multiplay Package are you using?

Unity 2022.2.7f1
Multiplay 1.2.2

I have uploaded the project

So the advice of someone on discord confirms that it is probably related to the
serverCheckManager.UpdateServerCheck();
call in the MultiplayAllocationService.

The suggestion was to be “triple” certain that call is being made, and even to just call it in the update loop.

Since the multiplay allocation service is not a monohebehaviour, we will need to the use the update loop in the ApplicationController.

In the ApplicationController store a reference to the serverSignleton:
private ServerSingleton serverSingleton;
In LaunchInMode, save the reference after creating the serverSingleton (notice the class declaration is removed):
serverSingleton = Instantiate(serverPrefab);
Create an updated in the application controller and call to the server to run the update check:

private void Update()
    {
        if(serverSingleton.GameManager != null)
        {
            serverSingleton.GameManager.UpdateCheck();
        }
    }

Define UpdateCheck in the ServerGameManager:

public void UpdateCheck()
    {
        if(multiplayAllocationService != null)
        {
            multiplayAllocationService.ServerCheckup();
        }
    }

Define ServerCheckup Method in the MultiplayAllocationService:

public void ServerCheckup()
    {
        if(serverCheckManager != null)
        {
            serverCheckManager.UpdateServerCheck();
        }
    }

This will just force it to run every frame, and should help us confirm whether or not this check is the source of the error, assuming the server and multiplayAllocationService are both being created correctly…

Privacy & Terms