I get the error "The name 'PlayGames' does not exist in the current context" when I try to use GooglePlayGamesServices
08:25 28 Aug 2026

I get the following error in this code when I try to sign in with GooglePlayGamesServices in a non Unity Android project in Visual Studio.

The name 'PlayGames' does not exist in the current context

var gamesSignInClient = PlayGames.GetGamesSignInClient(this);

How can I use GetGamesSignInClient in my Android project?

How can I get the ServerAuthCode for Sign in with GooglePlayGamesServices?


var gamesSignInClient = PlayGames.GetGamesSignInClient(this);

gamesSignInClient.RequestServerSideAccess(
    webClientId,
    false
).AddOnCompleteListener(task =>
{
    if (task.IsSuccessful)
    {
        var authResponse = task.Result;
        var serverAuthCode = authResponse.AuthCode;

        // Pass this to PlayFab
        var request = new LoginWithGooglePlayGamesServicesRequest
        {
            TitleId = PlayFabSettings.TitleId,
            ServerAuthCode = serverAuthCode,
            CreateAccount = true
        };

        PlayFabClientAPI.LoginWithGooglePlayGamesServices(
            request,
            result => { },
            error => { }
        );
    }
});
c# google-play-games