Sing in

The best practice is to start the sign-in flow right after application start.

All you need to do is to call Connect function:




The following code snippet show how you can subscribe for the connect / disconnect actions:

UM_GameServiceManager.OnPlayerConnected += OnPlayerConnected;
UM_GameServiceManager.OnPlayerDisconnected += OnPlayerDisconnected;

private void OnPlayerConnected() {
	Debug.Log("Player Connected");

private void OnPlayerDisconnected() {
	Debug.Log("Player Disconnected");



You can always find out current connection state with the ConnectionSate property.




You may also use Disconnect method if you want to disconnect from the Game Service.



Note: On The IOS platform method does nothing.  Due to Game Center API guidelines.


The code snippet bellow shows how to check if the player is currently connected to game service.

if(UM_GameServiceManager.instance.ConnectionSate == UM_ConnectionState.CONNECTED) 



Available connection states:

public enum UM_ConnectionState  {



After player is successfully connected you may use player properties to retrieve information about current player. The code snippet bellow shows how to display player name, id and avatar with Unity GUI:

if(UM_GameServiceManager.instance.player != null) {
	GUI.Label(new Rect(100, 10, Screen.width, 40), "ID: " + UM_GameServiceManager.instance.player.PlayerId);
	GUI.Label(new Rect(100, 20, Screen.width, 40), "Name: " +  UM_GameServiceManager.instance.player.Name);
	if(UM_GameServiceManager.instance.player.Avatar != null) {
		GUI.DrawTexture(new Rect(10, 10, 75, 75), UM_GameServiceManager.instance.player.Avatar);



The player property is represented as GameServicePlayerTemplate object. 

public class GameServicePlayerTemplate  {
    public string PlayerId {get;}
    public string Name {get;}
    public Texture2D Avatar {get;}
    public GameCenterPlayerTemplate GameCenterPlayer {get;}
    public GooglePlayerTemplate GooglePlayPlayer {get;}

public class GameCenterPlayerTemplate {
    public string playerId {get;}
	public string alias {get;}
	public string displayName {get;} 
	public Texture2D avatar {get;}

public class GooglePlayerTemplate {
    public string playerId {get;}
	public string name {get;}
	public bool hasIconImage {get;}
	public bool hasHiResImage {get;}
	public string iconImageUrl {get;}
	public string hiResImageUrl {get;}
	public Texture2D icon {get;}
	public Texture2D image {get;}




The full API use example can be founded under the UM_GameServiceBasics example scene.