Search code examples
c#unity-game-enginegoogle-playgoogle-play-games

GooglePlayGames loading logo pops up everytime I start my app


So I want to implement GooglePlayGames services into my Unity3D game but everytime I open my game from my android device it pops up the google play games loading logo and this happens everytime. I also can not open the leaderboard and achievements UI. I have set up everything in the developer console and my project. I have added my email as a tester. Here is my code:

This is a script attached to my camera

using UnityEngine;
using System.Collections;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;


public class GooglePlayGamesScript : MonoBehaviour {

// Use this for initialization
void Awake () {
    PlayGamesPlatform.DebugLogEnabled = true;
    PlayGamesPlatform.Activate();

}

// Update is called once per frame
void Start () {
    if(!Social.localUser.authenticated){
    Social.localUser.Authenticate((bool success) => {
        Debug.Log("Authenticating");
        });
    }
}

}

and here I try to report score:

Social.ReportScore(AddPoints.HighScore,"770479155009",
(bool success) => {
Debug.Log("reporting score");
});

If anyone has any idea what can be causing this, please let me know. Also I should mention that my game isn't published.


Solution

  • This is happening because your user is never getting authenticated. Could happen for a few reasons. Here's a couple I myself have faced earlier.

    1. Trying to run GPG in an unpublished app. This has been the cause of my problems a few times. Upload a build in the Alpha Channel, and ensure that the ID you're using is part of the list of approved testers. Also, don't forget to publish the game in GPG as well.

    2. If you're running any apps that interfere with Play Services, stop them. One that gave me a ton of grief was Freedom. Generally, just stop anything that possibly uses SU