Facebook Friends
This feature allows retrieving the player's Facebook friends who also play the game.
Configuration is done via the Settings Inspector in Unity.
Configuration is applied automatically at build time for each platform.
Platform markersโ
The following markers are used to indicate platform availability of parameters and features:
- (no marker) โ Shared parameter or feature
- ๐ โ iOS-specific parameter or feature
- ๐ค โ Android-specific parameter or feature
- โ ๏ธ โ Not implemented in the Unity plugin yet
Ask your release manager for the required parameters before configuring the SDK.
Configurationโ
This feature requires Facebook Authorization to be set up.
Usageโ
Get Social Friendsโ
To request the user's friend list:
P101XP.GetInstance().GetSocialFriends();
The result is delivered through SocialFriendsEvent.
Eventsโ
Always subscribe before making the request:
private void SocialFriendsHandler(FriendsContainer friendsContainer)
{
}
P101XP.GetInstance().SocialFriendsEvent += SocialFriendsHandler;
FriendsContainerโ
public class FriendsContainer
{
public List<SocialFriend> friends;
public string error;
}
Fieldsโ
| Field | Type | Description |
|---|---|---|
| friends | List<SocialFriend> | List of friends playing this game |
| error | string | Error message or null if request succeeded |
SocialFriendโ
public class SocialFriend
{
public int level;
public long mobileId;
public string name;
public string pictureUrl;
public string socialNetId;
}
Fieldsโ
| Field | Type | Description |
|---|---|---|
| level | int | Player's in-game level |
| mobileId | long | 101XP mobile ID |
| name | string | Friend's display name |
| pictureUrl | string | URL to the friendโs social avatar |
| socialNetId | string | Social network user ID |