So I have been recently trying to add Google Play Game Services to a project my buddy and I are working on.
I figured I would start with the sign in, as that is necessary for anything else that we wanted to add like achievements and leaderboards.
Anyway, I have published a closed Alpha to the google play store with my buddies dev and my own dev emails as the testers. I have set up my OAuth2 Client ID, SHA 1, AndroidManifest file, and other Game Services we are hoping for.
I then in Unity included the most recent Google Play Games Plugin (0.9.50), and set up the Resources and Client ID into our project. I of course have my Key and such for a Signed APK for our Closed Alpha test.
I then set up a button for Sign In within our scene, and have my code set up as follows:
void Start ()
{
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.RequestEmail()
.RequestServerAuthCode(false)
.RequestIdToken()
.Build();
//DEBUGGING ONLY
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
// Does nothing either . . . .
Social.Instance.Authenticate((bool success) => { SignInCallback(success); }, false);
}
public void SignIn()
{
_signInNotification.text = "WARMER";
if (!PlayGamesPlatform.Instance.localUser.authenticated)
{
_signInNotification.text = "SIGNING IN";
Social.localUser.Authenticate((bool success) => { SignInCallback(success); });
}
else
{
PlayGamesPlatform.Instance.SignOut();
_signInNotification.text = "OUT";
}
}
private void SignInCallback(bool success)
{
if (success)
{
Debug.Log("(Something) Signed in!");
_signInNotification.text = "Signed In as : " + Social.localUser.userName;
}
else
{
Debug.Log("(Something) Sign-In Failed!");
_signInNotification.text = "Sign-In Failed!";
}
}
I have some text that lets me know what part of the code was accessed or run. The sign in button calls the SignIn() function, but only the text āWARMERā is shown. The Social.localUser.Authenticate() function never seems to be called.
I have tried multiple solutions, changes, variations, etc. However when I click the SignIn button, absolutely nothing happens. No error, no warnings, no text saying Sign-In Failed, nothing.
Not quite sure what I am missing, any ideas would be greatly appreciated!
Did you find a solution? I am at the same point. Did multiple restarts, following multiple tutorials multiple times. Seems like everywhere people point to either SDK problems, changing the API console certificate to the upload certificate, or adding testers. I have played with every possibility with the above. When running the alpha from build and run or through the app store, when I press connect, no google sign in pops up.
where āGoWarningā is my own tool for showing text on a mobile it shows nothing. Itās never called, so itās not an exception. Something inside Authenticate method fails to even call an authentication routine and quits without ever calling a callback action
I exported the project in to android studio and built from there. Now it is working fine. I dont know what causes the problem.May be something wrong with the unity gradle build.
BTW thanks for the reply
Iām reviving this old topic because I am having the exact same issue OP is having and I have done everything OP has mentioned. And also there does not seem to be any solution posted yet.
I have the signin functionality attached to a button but clicking on it does absolutely nothing⦠the OAth box doesnt show up, nothing happens.
I had exactly same issue on last year.
After call authenticate function, nothing happened, even no error log.
And now itās solved!
But I donāt know what was the problem exactly bcuz I tried many things together.
There is just what i did.
1. Updated Unity version to 2019.2.12f1
I started my project with 2017.3.1. My problem started here.
To try to fix it, I updated to 2018.2.3 but still not solved (It was last year)
Few days ago, I suddenly wanna try to fix it again so I updated to 2019.2.12 again. (Current version)
version 2019.2 recommend you to include JDK, SDK, NDK, Gradle in Unity then I did.
It takes long time to install everything again.
3. Linked app twice and Create Three of OAuth 2.0 client IDs
On Google Play Console - Game Service - Linked Apps page,
I linked my app twice using āApp signing certificateā and āUpload certificateā.
(So created two of different OAuth 2.0 client IDs)
and in the Google API Console(https://console.developers.google.com/), I created credentials type of web application too.
I used it for Web Application ID (optional) in Google Play Game Setup in Unity.
So I got totally three of OAuth 2.0 client IDs.
Iām not sure if itās right way to do but I just wanted to do everything what I can do to fix.
When I did until here, my problem still happened. Nothing changed yet.
4. Build APK when GPGSUpgrader error is not happened.
When I play my game in Unity debug mode, Sometimes GPGSUpgrader error appeared but not always.
This error occurred on āAssetDatabase.Refresh();ā in GPGSUpgrader.cs
It happens sometimes and it disappears when I restart Unity.
After I restart Unity, I play my game to check if any error log appear.
When there is no error log, I build APK. Then it works!!
Iām not sure what is right way exactly but my problem solved with them.
I hope it can work for you too.
So, after around 6 hours trying to solve this I could connect and request the auth code (using RequestServerAuthCode on the builder) by changing the Client ID on the Google Play Games Setup plugin window in Unity for the one I created on the APIs page, the Client ID inserted there was the one for the Android Client instead of Web Client which was wrong. Using the Client ID of the Web Client credential (created on Google APIs page) and hitting Setup did the trick.
I am in a similar problem, When ever I build and run the app, it shows Connecting to Google Play Games but then nothing happens, neither it connects to PlayGames
I think this happens when you forgot to add your email account (used on your android phone) to the tester accounts on google play developer console and google play games services section