question

Yacine Betouche avatar image
Yacine Betouche asked

How Can I Get An Attribute From A Player To Send To The Other In PlayFab?

Viewed 12 times

0

I'm new to PlayFab & PlayFab API, I'm trying to do matchmaking for my P2P multiplayer game, I created a match tikect successfully, but now I want to get the IP attribute of the other player when the match starts, how can do that ?

public void StartMatchmaking()
    {
        cancelMatchButton.SetActive(false);
        queueStatusText.text = "Searching For Player...";
        randomMatchMakingPanel.SetActive(true);
        mainPanel.SetActive(false);
      
        PlayFabMultiplayerAPI.CreateMatchmakingTicket(
            new CreateMatchmakingTicketRequest
        {
            Creator = new MatchmakingPlayer
            {
                Entity = new EntityKey
                {
                    Id = authentication.id,
                    Type = "title_player_account",
                },
                Attributes = new MatchmakingPlayerAttributes
                {
                    DataObject = new { IP = playerID }
                }
            },

            GiveUpAfterSeconds = 120,

            QueueName = queueName
        },
        OnMatchmakingTicketCreated,
        OnMatchmakingError
        );
    }
private void OnGetMatch(GetMatchResult result)
    {
        //storing the players IDs on the PlayersIDSaver two join them
        idSaver.ManageIDs(result.GetMatch.ReturnMemberAttributes[0].IP, result.GetMatch.ReturnMemberAttributes[1].IP);
        SceneManager.LoadScene(multiplayerSceneName);
    }```
apisPlayer DatasdksMatchmakingAuthentication
10 |1200

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

1 Answer

·
JayZuo avatar image
JayZuo answered

For P2P scenario, we have a workaround here: Workaround for peer-to-peer connection - PlayFab | Microsoft Docs. With this, you can Retrieving all player IPs from a Match.

10 |1200

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

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]