Game Center is a great way to play multiplayer games on your iPhone and iPad with existing friends as well as play with new ones. If you have a friend who you'd like to be able to play against and you have a lot of the same games in common, you can add them as a friend in Game Center which makes it easy to create a match up any time you'd like.

Retrieving Friends List

Getting info about friends of player Game Center is pretty simple. Here is an example of how you can send a load request of friends and get a result.

GameCenterManager.OnFriendsListLoaded += OnFriendsListLoaded;

private void OnFriendsListLoaded (ISN_Result result) {
	GameCenterManager.OnFriendsListLoaded -= OnFriendsListLoaded;
	if(result.IsSucceeded) {
		renderFriendsList = true;

As soon as a friend list is loaded, we can get all current player friends ids using GameCenterManager.FriendsList

public static List<string> FriendsList

We can get friend info which is represented as GK_Player object as showed on the code snippet bellow:

GK_Player player = GameCenterManager.GetPlayerById(FriendId)

Note: Plugin automatically triggers player info download after we get 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 have got info about player id, it means the plugin will automatically send player info request.
  2. The player info request can take some time, so it is always a good practice to check if player info exists before using it. 

All loaded player objects are available in the Players Dictionary of GameCenterManager class.

public static Dictionary<string, GK_Player> Players

The GameKit allows us to download 2 photo sizes of the player. Available sizes can be found in the GK_PhotoSize enum. The user photo images are available as Texture2D. But before you can get player's photo, you need to send the dowload request. Simple example how to download normal size player photo for the current player is showed bellow:

GK_Player player = GameCenterManager.Player;
player.OnPlayerPhotoLoaded += HandleOnPlayerPhotoLoaded;

void HandleOnPlayerPhotoLoaded (GK_UserPhotoLoadResult result) {
	if(result.IsSucceeded) {

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

But you should understand that this can make a negative impact in your game RAM consumption as the photo images will be loaded for each player who is available in Player Dictionary.

The code snippet bellow shows a friend's list printing implementation example.

GUI.Label(new Rect(10,  90, 100, 40), "id", boardStyle);
GUI.Label(new Rect(150, 90, 100, 40), "name", boardStyle);;
GUI.Label(new Rect(300, 90, 100, 40), "avatar ", boardStyle);
int i = 1;
foreach(string FriendId in GameCenterManager.FriendsList) {

	GK_Player player = GameCenterManager.GetPlayerById(FriendId);
	if(player != null) {
		GUI.Label(new Rect(10,  90 + 70 * i, 100, 40), player.Id, boardStyle);
		GUI.Label(new Rect(150, 90 + 70 * i , 100, 40), player.Alias, boardStyle);
		if(player.SmallPhoto != null) {
			GUI.DrawTexture(new Rect(300, 75 + 70 * i, 50, 50), player.SmallPhoto);
		} else  {
			GUI.Label(new Rect(300, 90 + 70 * i, 100, 40), "no photo ", boardStyle);


Game Center Friends Invitation

To show a friend request, initialize a new GK_FriendRequest object. Optionally, you can customize the request by adding a list of recipients. See the code example bellow:

GK_FriendRequest r =  new GK_FriendRequest();
r.addRecipientsWithEmailAddresses("", "");

API Reference


public class GK_FriendRequest {

	/// <summary>
	/// Adds recipients based on their email addresses..
	/// If you do not add at least once recipient, the recipients 
	/// field is selected when the view controller is presented so 
	/// that the player can type a list of recipients. 
	/// Adding more players than defined by the
	/// <param name="emailAddresses">A string that identifies the saved game data to be deleted.</param>
	/// </summary>
	public void addRecipientsWithEmailAddresses(params string[] emailAddresses);
	/// <summary>
	/// Adds recipients based on their Game Center player identifiers.
	/// If you do not add at least once recipient, the recipients 
	/// field is selected when the view controller is presented 
	/// so that the player can type a list of recipients.
	/// <param name="players">An array with one or more GK_Player objects.</param>
	/// </summary>
	public void  addRecipientPlayers(params GK_Player[] players);

	/// <summary>
	/// Start's Friend Request view controller
	/// </summary>
	public void Send();


Example Scenes

A full example of API using can be found in FriendsLoadExample  example scene.