- Home /
Google Play Services Working, but not Working?
I've been watching and reading tutorials for days, and I'm stumped. Hopefully someone here can shed some light. I integrated the Google Play Services package and modified my script. I have achievements and leaderboards in place, and a debug gui that tells me whether or not user authentication was successful. Just to be safe, I added a button that forces authentication again when pressed. According to debug, authentication works fine. But... There is no sign in window, there is no notification when an achievement requirement is met, and the achievement and leaderboard buttons are unresponsive. Here's the relevant bits of my code:
using UnityEngine;
using System.Collections;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
public class GooglePlay : MonoBehaviour {
void Start ()
{
AuthenticateUser ();
}
bool showAuthFailure;
bool showAuthSuccess;
void AuthenticateUser()
{
PlayGamesPlatform.Activate ();
Social.localUser.Authenticate((bool success) => {
if(!success)
showAuthFailure = true;
if(success)
showAuthSuccess = true;
});
}
public void ShowAchievements()
{
Social.ShowAchievementsUI();
}
public void ShowLeaderboard()
{
Social.ShowLeaderboardUI();
}
public void PostToLeaderboard(int score)
{
Social.ReportScore (score, "CgkI_7vourIJEAIQHQ", (bool success) => {
//TODO handle success or failure
});
}
public void UnlockAchievement()
{
Social.ReportProgress("Cgkl_7vourlJEAIQAg", 100.0f, (bool success) => {
//TODO handle success or failure
});
}
bool showGUI = true;
bool showButton = true;
void OnGUI()
{
GUILayout.BeginArea(new Rect(5, 5, Screen.width/2, Screen.height));
if (showButton)
{
if(GUILayout.Button ("Authenticate!"))
{
AuthenticateUser();
showButton = false;
}
}
if (showGUI)
{
GUILayout.BeginVertical ("box");
if (showAuthSuccess) {
if (GUILayout.Button ("Google User Authenticated!"))
{
showAuthSuccess = false;
showGUI = false;
}
}
if (showAuthFailure) {
if (GUILayout.Button ("Use Authentication Failed!"))
{
showAuthFailure = false;
showGUI = false;
}
}
GUILayout.Label(Social.localUser.userName);
GUILayout.Label(Social.localUser.id);
GUILayout.Label(Social.localUser.image);
GUILayout.EndVertical ();
}
GUILayout.EndArea ();
}
When you start the game, the gui clearly displays: Google User Authenticated. Something must be working, right?
Answer by Jabrils · Jun 22, 2016 at 05:13 AM
Hey did you ever figure this out? I am currently stumped on the same exact problem & would love for you to spread the wealth of knowledge :D
Answer by virgilcwyile · Aug 19, 2017 at 12:18 PM
I guess you forgot, PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
Before PlayGamesPlatform.Activate();
Your answer
Follow this Question
Related Questions
Google Play Games plugin for Unity Not Authenticating 9 Answers
Google play achievements problem please help 2 Answers
Convert android URI to usable path 0 Answers
Google Play load problem 0 Answers
Player is not authenticating - Google Play Games plugin for Unity not authenticating for android 2 Answers