question

g9gamesidn avatar image
g9gamesidn asked

PlayFab RequestMultiplayerServer always returns null

I don't know what's wrong, it seems that PlayFabMultiplayerAPI.RequestMultiplayerServer returns null, note that I already fill the build ID, My build status on playfab is deployed, and I already set the region to NorthEurope (same with the build VM region configuration)

Here are the codes:

private void RequestMultiplayerServer()
    {
        Debug.Log("[ClientStartUp].RequestMultiplayerServer");
        RequestMultiplayerServerRequest requestData = new RequestMultiplayerServerRequest();
        requestData.BuildId = configuration.buildId;
        requestData.SessionId = System.Guid.NewGuid().ToString();
        requestData.PreferredRegions = new List<AzureRegion>() { AzureRegion.NorthEurope};
        PlayFabMultiplayerAPI.RequestMultiplayerServer(requestData, OnRequestMultiplayerServer, OnRequestMultiplayerServerError);
    }

    private void OnRequestMultiplayerServer(RequestMultiplayerServerResponse response)
    {
        Debug.Log(response.ToString());
        ConnectRemoteClient(response);
    }

    private void ConnectRemoteClient(RequestMultiplayerServerResponse response = null)
    {
        if(response == null) 
        {
            networkManager.networkAddress = configuration.ipAddress;
            telepathyTransport.port = configuration.port;
            apathyTransport.port = configuration.port;
        }
        else
        {
            networkManager.networkAddress = response.IPV4Address;
            telepathyTransport.port = (ushort)response.Ports[0].Num;
            apathyTransport.port = (ushort)response.Ports[0].Num;
        }

        networkManager.StartClient();
    }

    private void OnRequestMultiplayerServerError(PlayFabError error)
    {
        Debug.Log(error.ErrorDetails);
    }
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Gosen Gao avatar image Gosen Gao commented ·

I test RequestMultiplayerServer API with Postman and it works fine. You should be able to know if the response is null or not based on the debug on line 13. What is the debug info here? Also, what does the “= null” on line 17 mean? Can you remove it and try again?

0 Likes 0 ·

1 Answer

·
g9gamesidn avatar image
g9gamesidn answered

@Gosen Gao I followed a tutorial on youtube and I did what the people in the video did but mine didn't work, maybe you can watch it or download the unity project on GitHub and test it by yourself, I'm really confused right now because I didn't know what I did wrong

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Gosen Gao avatar image Gosen Gao commented ·

Still the same question? If not, please post another question with a detailed error message and indicate which part doesn't work.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.