question

Mark Nagy avatar image
Mark Nagy asked

How to handle segment result?

Hello, I'm trying to get all players from "AllPlayers" segment. I can get player profiles that I can debug in unity, but I don't know how to handle this information. Is there some "PlayerProfile" class I can store this and use? Or how do I get Display Names from cloud script result of that segment?

Thank's for any help, Mark.

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

If you are calling GetPlayersInSegment in the CloudScript, then you can use JSON to handle the function result. The code below is for your reference.

PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
{
    FunctionName = "TsProfile"
}, result => {
    var profs = JObject.Parse(result.FunctionResult.ToString());
    foreach (var prof in profs["PlayerProfiles"]){
        Debug.Log(prof["DisplayName"]);
    }
    Debug.Log(profs["PlayerProfiles"][1]["DisplayName"].ToString());
}, error => {
    Debug.LogError(error.GenerateErrorReport());
});

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.

Mark Nagy avatar image Mark Nagy commented ·

Thank you for your answer. I was hoping there is whole "PlayerProfile" class that I can store this kind of information... I gas there is not. Thank you

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.