Hi,
I am just testing the google play services with a simple Unity project to understand how google play services work so when I decide to integrate these services in the game that I am developing I know what I should do. So, I created an empty project in Unity and added one button for sign in and a text to display the message if the authentication was successful or failed. Then i downloaded google play services plugin for unity from github and imported the package in my project. The I went to google play console and created a new application step by step until everything turned green and ready to publish the game. I created a leaderboard also and then copied the resources from google play console and then in Unity i opened Window>Google Play Games>Setup>Android Setup, pasted the resources and and clicked Setup. Then it was completed. Then used these codes and assigned the text and the function of the sign in button. Here are the codes I am using:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SocialPlatforms;
using GooglePlayGames;
public class Manager : MonoBehaviour {
[SerializeField]
private Text authenticationTxt;
void Start ()
{
PlayGamesPlatform.Activate ();
PlayGamesPlatform.DebugLogEnabled = true;
}
public void SignIn()
{
if (!Social.localUser.authenticated) {
Social.localUser.Authenticate ((bool success) => {
if(success)
{
authenticationTxt.text = "Authenticated !";
}
else
{
authenticationTxt.text = "Failed Authentication";
}
});
}
}
//Haven't used this yet...
public void ShowLeaderboard()
{
//...
}
}
I signed a keystore for my game in Unity and clicked build and run. When I run my game in my device i clicked the sign in button and waited to sign in but the authentication failed. I did include my email as a tester in google play console so this is not the problem. Now I have no idea why the authentication process is failing.
If anyone has encountered this same problem before would be nice to tell me.
Thank you,
Gerald.