Google Play Game Services not working in Unity

I created a game using Unity and now I want to add Play Services in my game. I have uploaded the game on the Google Play Store from the Console, downloaded the play services plugin from GitHub, added it in my Unity project, installed Google Play Services tools from the SDK Manager, created the achievements and the leaderboard and copied the resources to Unity. I even copied the SHA-1 from the Upload Certificate to the Google API credentials. In short, I did every solution I could find on Google.
The problem is…

private void SignIn()
    {
        Social.localUser.Authenticate((bool success) =>
        {
            if (success)
            {
                Destroy(testObject);
            }
            else
            {
                Destroy(testObject2);
            }
        });
    }

None of these objects are destroyed. Thanks in advance.

I found the solution. Go to your Publishing Settings tab in the Player Settings. and set the options like this…

132877-annotation-2019-02-10-152546.jpg

Then open the proguard-user.txt file and type in this…

-keep class com.google.games.** { _; } 
-keep interface com.google.games._* { *; }

Save it and it will surely work.

@TusharVaid30 I don’t know how to thank you for your solution. It fixed my problem which has harassed me for the last 10 days. God bless you !!!

Same problem can you help us guys?

For Google Play Games to work on Android, you have to first configurate and activate PlayGames. Here’s how you do it:

PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
			.Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
PlayGamesPlatform.DebugLogEnabled = true;

And then you sign in.

How it would look in the start method:

void Start() {
    #if UNITY_ANDROID // Only run on android, because it's not needed for iOS
    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        .Build();
    PlayGamesPlatform.InitializeInstance(config);
    PlayGamesPlatform.Activate();
    PlayGamesPlatform.DebugLogEnabled = true;
    #endif
    SignIn();
}

private void SignIn()
{   
    Social.localUser.Authenticate((bool success) =>
    {
        if (success)
        {
            Destroy(testObject);
        }
        else
        {
            Destroy(testObject2);
        }
    });
}