contrejo27 avatar image
contrejo27 asked

FriendPlayFabId vs playfabid?

When I get friend list's FriendInfo.FriendPlayFabId it doesn't seem to match the playfab id of the player. I'm confused I don't even see that specific id anywhere in any player. I'm returning the user name which is right but FriendPlayFabId isn't. is FriendPlayFabId the same thing as playfab id?

            foreach (FriendInfo friend in AccountController.controller.friends)
                PlayfabUserData playfabUserData = new PlayfabUserData();
                playfabUserData.playfabId = friend.FriendPlayFabId;
                playfabUserData.username = friend.Username;
                GameObject player = Instantiate(playerListItem, playerListContainer.transform);

/// when I run this, it tells me there's no player with that id

public void CHALLENGE_FRIEND(string playfabID) { print("Challenging friend with playfab id " + playfabID); var data = new Dictionary<string, object>() { {"FriendChallenged", playfabEntityId}, }; var dataList = new List<SetObject>() { new SetObject() { ObjectName = "FriendData", DataObject = data }, }; PlayFabDataAPI.SetObjects(new SetObjectsRequest() { Entity = new EntityKey { Id = playfabID, Type = playfabEntityType }, // Saved from GetEntityToken, or a specified key created from a titlePlayerId, CharacterId, etc Objects = dataList, }, (setResult) => { Debug.Log("Friend Challenged" + setResult.ToString()); }, DisplayPlayFabError); }

//this is how I'm finding friends

public void GET_FRIENDS() { //reset friend list and find again in case we have a new friend in list friends = null; PlayFabClientAPI.GetFriendsList(new GetFriendsListRequest { IncludeSteamFriends = false, IncludeFacebookFriends = false, XboxToken = null }, result => { friends = result.Friends; }, DisplayPlayFabError); }
Player DataentitiesFriends
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

Rick Chen avatar image
Rick Chen answered

The FriendPlayFabId in the GetFriendsList is the PlayFab unique identifier i.e. PlayFabId for this friend. You should be able to search the player with FriendPlayFabId in [Your GameManager]->[Players]. You mentioned that when you run the code snippet 2, it tells you there's no player with that id. And I noticed that in code snippet you used SetObjects API and used the PlayFabId as the EntityId. This can be the cause of the issue.

The Entities are the most basic addressable "things" that PlayFab APIs operate on. Each entity has a Type and an Id which together uniquely identify it. Some types of entities are "standard" or "built-in", in that PlayFab knows something about their meaning and/or automatically creates them, for example, master_player_account, and title_player_account. The PlayFabId is themaster_player_account type EntityId which is different to the title_player_account type EntityId. For more details you can refer to Entities quickstart. You can use the title_player_account type EntityId instead when you call the SetObjects API (line 24 of your code snippet 2).

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.

contrejo27 avatar image contrejo27 commented ·

Thank you! Makes sense.

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.

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