question

Jeffrey Campbell avatar image
Jeffrey Campbell asked

GetPlayerProfileRequest result says, Player not is game.

I am trying to retrieve other player profile data like display name etc. I tried on client's side as well as via cloud script but the result is the same "Player profile does not exist".

PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest() { FunctionName = "getPlayerProfile", FunctionParameter = new { playFabId = entities[i].Members[j].Key.Id, }, GeneratePlayStreamEvent = true }, response => { Debug.Log(response.FunctionResult.ToString()); for (int i = 0; i < response.Logs.Count; i++) { Debug.Log(response.Logs[i].Message); } TeamMemberDetails teamMember = Instantiate(teamMemberPrefab, teamDetailParent); //teamMember.SetData(JsonUtility.FromJson(response.FunctionResult.ToString())); }, error => { Debug.Log("Error " + error.Error); });


handlers.getPlayerProfile = function(args, context){

 var profile;
     log.debug(args.playFabId);

 try{
  profile = server.GetPlayerProfile( {PlayFabId: args.playFabId, ProfileConstraints: { ShowDisplayName: true}} );
        
 }
 catch (error) {
     log.error(error);
     return "group";
 }
  return profile;  

}

Please let me know How can I retrieve the other players (opponent data).

Player Data
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

·
Simon Cui avatar image
Simon Cui answered

I tested your codes logic, and it worked well. But I noticed that you were using playFabId = entities[i].Members[j].Key.Id inside FunctionParameter. I suggest you double check if the playFabId is valid and make sure it belongs to master_player_account type instead of title_player_account. For more information, please refer to Available Built-In Entity Types - PlayFab | Microsoft Learn.

Besides, if you want to implement GetPlayerProfile via Client API, you need to configure allowed properties through [Game Manager] -> [Your title] -> [Title settings] -> [Client Profile Options], referring to: Account Management - Get Player Profile - REST API (PlayFab Client) | Microsoft Learn.

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.