Friends

Getting info about the player's Google Play friends is pretty simple. Here is an example on how you can send a load request to and get the result.

UM_GameServiceManager.ActionFriendsListLoaded += HandleActionFriendsListLoaded;
UM_GameServiceManager.Instance.LoadFriends();

void HandleActionFriendsListLoaded (UM_Result res) {
	if(res.IsSucceeded) {
		Debug.Log("user has " + UM_GameServiceManager.Instance.FriendsList.Count + " friends");
	} else {
		Debug.Log("Friends load failed");
	}
}

As soon as friend's list is loaded, we can get all current player friend's id's using UM_GameServiceManager.Instance.FriendsList

public List<string> FriendsList

We can get info of a friend, which is represented as UM_PlayerTemplate object as showed on the code snippet bellow

UM_Player player = UM_GameServiceManager.Instance.GetPlayer(FriendId);

 

Note: Plugin automatically triggers player info download after we got player id from friends load request or from any other request for example score list request. Which basically means 2 things:

  1. You do not have to send player info load request by yourself. If you got info about player id, it means the plugin will send player info request automatically.
  2. The player info request may take some time, so it is always a good practice to check if player info exists before using it. 

You can download small and big player's photos The user photo images are available as Texture2D. But before you can get player's photo, you need to send the download request. Simple example on how to download player photo in normail size for the current player, is showed bellow.

UM_Player player = UM_GameServiceManager.Instance.Player;
player.LoadSmallPhoto();
player.SmallPhotoLoaded += HandleSmallPhotoLoaded;

void HandleSmallPhotoLoaded (Texture2D obj) {
	Debug.Log("Player Photo loaded")
}

Player's photo can be downloaded automatically by the plugin as soon as Player info is received. It will allow you not to call LoadPhoto function for each player you want to get a photo manually. Just use the editor settings as showed on the screenshot bellow.