question

Abdelrahman Awwad avatar image
Abdelrahman Awwad asked

Get Display name from Title player ID (Not Playfab ID)

After matchmaking each player gets a GetMatchResult Containing a list of MatchmakingPlayerWithTeamAssignment which in turn contains entities with IDs of players matched together ... I've checked and it's not the Playfab ID .. its the title specific ID .. unless GetMatchResult contains the actual Playfab ID (which I could then use to query the Display Name) .. How can I use the title specific Player ID to get the display name of matched players

Player DataTitle DataMatchmaking
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

·
Gosen Gao avatar image
Gosen Gao answered

You can add DispalyName to Attributes when your client creates a MatchmakingTicket, and then you can set ReturnMemberAttributes to true to get it when calling GetMatch. Here is my Attributes for your referance.

"Attributes":{
          "DataObject":{
              "DisplayName": "Gosen",
              "Skill": 10.4,
              "Build": "1.0.0.0",
              "PlayerCount":1,
              "GameMode":["Random"],
              "Latencies": [
                    {
                        "region": "EastUs",
                        "latency": 150
                    },
                    {
                        "region": "WestUs",
                        "latency": 400
                    }
                ]
          }
      }

2 comments
10 |1200

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

Abdelrahman Awwad avatar image Abdelrahman Awwad commented ·

Nice Idea.. I added it to the DataObject under Attributes and can confirm that all the members get each other's display names by Debug.Log(DataObject) .. I'm just having difficulty accessing the string of the display name by itself ... This is JSON format, Am I correct? .. I have no Idea how to handle it and it took me ages to just figure out how to pass in the "Latencies" Term to make it work with multiplayer servers ...
Can you please explain how to handle those kinds of objects in C# or what they even are ?

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao Abdelrahman Awwad commented ·

You can try code below:

public class Latency{
    public string region;
    public int latency;
}
public class DataObject
{
    public string DisplayName;
    public float Skill;
    public string Build;
    public int PlayerCount;
    public List<string> GameMode;
    public List<Latency> Latencies;
}
var data = JsonConvert.DeserializeObject<DataObject>(result.Members[0].Attributes.DataObject.ToString());
Debug.Log(data.DisplayName);
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.