Prerequisites
SDK: Unity
- The title ID is set in the
PlayFabSharedSettingsobject. - The project can successfully log in a user.
- The title has at least two registered users.
About friends
Any player in your title may be friends with any other player in your title. Notably, friendship on PlayFab is a one-way street. If Albert adds Bob as a friend, there is no approval process for Bob. In fact, Bob may be unaware. Bob must separately add Albert for the friendship to be mutual. If you wish to have reciprocity rules, it is your title’s responsibility to enforce these conditions with a custom game server or CloudScript logic, if necessary. In the event that a player has linked their Steam, Facebook, or XBOX Live account, their platform-specific friends can also be displayed, if those friends also play your title.Making friends
The example code uses the functionsDisplayFriends(), and DisplayError(string error) as a proxy of your app’s UI. You paste these into your editor to get it to work without any extra effort - or replace the calls with your own code.
- Once a player logs in, they can access the UI for friends. The functionality usually includes adding, removing, and displaying friends, at a minimum.
- To get the player’s current friends list, use the GetFriendsList API call.
- To add a friend to the player’s friend list, use the AddFriend API call.
- To remove a player from a player’s friends list, use the RemoveFriend API call.
