Skip to content

Instantly share code, notes, and snippets.

@giacomelli
Last active April 21, 2020 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giacomelli/c8bff996de4473c201f010b17d42fd2b to your computer and use it in GitHub Desktop.
Save giacomelli/c8bff996de4473c201f010b17d42fd2b to your computer and use it in GitHub Desktop.
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine;
public class AchievementsController : MonoBehaviour
{
void Start()
{
var config = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
// Authenticate and register a ProcessAuthentication callback
// This call needs to be made before we can proceed to other calls in the Social API
Social.localUser.Authenticate(ProcessAuthentication);
}
// This function gets called when Authenticate completes
// Note that if the operation is successful, Social.localUser will contain data from the server.
void ProcessAuthentication(bool success)
{
if (success)
{
Debug.Log("Authenticated.");
PlayGamesPlatform.Instance.ShowAchievementsUI();
}
else
Debug.Log("Failed to authenticate");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment