How to Connect a Client to Unity Game Server Hosting Online?

'm currently facing a challenge in connecting a client to a game hosted on Unity’s Game Server Hosting (Multiplay) over the internet. I’ve managed to create a dedicated server build and successfully uploaded it to Multiplay. The allocation test was positive, and I can connect to the game server locally using the Unity Editor. However, transitioning this process to work online has been confusing and unsuccessful so far.

Here’s a summary of what I’ve tried and the obstacles I’ve encountered:

  • Direct Connection Attempt: Attempting to connect to the game server using its address and port directly hasn’t worked. It seems that some form of Unity-specific client input is necessary. Do I need to create a specific client build for this purpose?

  • WebGL Build: I’ve also experimented with a WebGL build but failed to establish any connection to the server. I haven’t configured any WebSockets, which might be the issue if the dedicated server build doesn’t set these up by default.

  • Linux Build: Considering the server’s Linux environment, I attempted a Linux build for the client. While this theoretically matches the server’s environment, I couldn’t make an online connection, even after bypassing graphics dependencies using the -batchmode and -nographics flags. My command line was as follows:

./executable.x86_64 -batchmode -nographics -logFile ./logFile.txt -ip "server-game-address" -port "9000"

I’m at a loss for how to proceed and would greatly appreciate any guidance, advice, or resources you could share. How can I successfully connect a client to our game server hosted online through Unity’s Game Server Hosting?

Thank you in advance for your help!

Maybe a bit late but basically you need to start by using the Game server lifecycle API
Unity Services Web API docs
Do the following from your client app:

  • Create your own UUID to assign to an allocation
  • Queue an allocation with a POST request
  • Poll with Get allocation request (using your UUID you made)
  • Once you receive back a valid allocation use its gamePort and ipv4 for your client to connect