Skip to content

Instantly share code, notes, and snippets.

@giacomelli
Last active December 3, 2025 16:08
Show Gist options
  • Select an option

  • Save giacomelli/c8bff996de4473c201f010b17d42fd2b to your computer and use it in GitHub Desktop.

Select an option

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