Hi, I'm trying to setup dedicated servers for multiplayer game created with Unity + Fusion.
On Client side 1. I'm logging in: PlayFabClientAPI.LoginWithCustomID(request, OnPlayFabLoginSuccess, OnLoginError);
OnPlayFabLoginSuccess - I'm requesting multiplayer server: PlayFabMultiplayerAPI.RequestMultiplayerServer(requestData, OnRequestMultiplayerServer, OnRequestMultiplayerServerError);
OnRequestMultiplayerServer - I'm trying to StartGame on Fusion NetworkRunner string ip = response.IPV4Address; ushort port = (?); var adress = NetAddress.CreateFromIpPort(ip, port); await _basicSpawner.StartGame(GameMode.Client, adress);
On Server side (I assume this is after Client 2. and before Client 3.) 1. I'm calling API.Start() PlayFabMultiplayerAgentAPI.Start(); PlayFabMultiplayerAgentAPI.OnServerActiveCallback += PlayfabOnServerActiveCallbackHandler;
PlayfabOnServerActiveCallbackHandler - I'm trying to StartGame on Fusion NetworkRunner string ip = PlayFabMultiplayerAgentAPI.GetGameServerConnectionInfo().PublicIPv4Address; ushort port = (?); var adress = NetAddress.CreateFromIpPort(ip, port); await _basicSpawner.StartGame(Fusion.GameMode.Server, adress);
BasicSpawner.StartGame method looks like this: public async Task StartGame(GameMode mode, NetAddress? address = null) { var networkRunnerGameObject = new GameObject(); networkRunnerGameObject.name = "Network Runner";
_runner = networkRunnerGameObject.AddComponent<NetworkRunner>();
_runner.ProvideInput = mode != GameMode.Server;
await _runner.StartGame(new StartGameArgs()
{
GameMode = mode,
SessionName = "playfab-photon-test",
Address = address,
Scene = SceneManager.GetActiveScene().buildIndex,
SceneManager = networkRunnerGameObject.AddComponent<NetworkSceneManagerDefault>()
});
}
Both on Server and Client I'm getting error from Fusion that it is unable to start a game: Failed to bind socket to [ip, port]
No matter what port I'm specyfing
On server side I was trying 0, 5055, 7777, 8080, all specified in PlayFabMultiplayerAgentAPI.GetGameServerConnectionInfo().GamePortsConfiguration GamePort.ServerListeningPort
Also on client side I was trying 0, 30000, 50000 and (ushort)response.Ports[0].Num
When adding build to playfab Server type - Container (Proccess is always unhealthy) Operating system - Windows Mount path - C:\Assets Start command - C:\Assets\game.exe
Unity 2022.2.21f1 For server I'm building Dedicated Server
What port should I pass for Fusion to sucessfully bind port?
Thanks