0
\$\begingroup\$

I am trying to login into play services. I got it working. But there were duplicate game objects created. So I added do not destroy on load and now the play services work the first time I access it.

But when I go to play game scene, end the game and come back to main menu, I can not seem to load the leaderboards.

public class PlayServices : MonoBehaviour {

public static PlayServices services;

private void Awake()
{
    if(services != null)
    {
        Destroy(gameObject);
    }
    else
    {
        services = this;
        DontDestroyOnLoad(gameObject);
    }
}

// Use this for initialization
private void Start () {
    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();

    PlayGamesPlatform.InitializeInstance(config);
    // recommended for debugging:
    PlayGamesPlatform.DebugLogEnabled = true;
    // Activate the Google Play Games platform
    PlayGamesPlatform.Activate();
    SignIn();
}
\$\endgroup\$
  • \$\begingroup\$ It works without the if else statement and just have: services = this; DontDestroyOnLoad(gameObject); But then I get duplicate play services objects \$\endgroup\$ – kirtan09 Mar 27 at 13:08
  • \$\begingroup\$ first is adb logcat to see your logs. then you can check what you are sending and what are responses. most of the time this is because server panel wron config or some proy or.... \$\endgroup\$ – virtouso Aug 25 at 6:11
0
\$\begingroup\$

Are you sure that the whole setup for the platform and sign-in-process is only called once? Add a debug log and make sure. Things can get weird, if you try to initialize google play services multiple times.

\$\endgroup\$
  • \$\begingroup\$ Yeah, I think I fixed it. I do the if else check in the sign in method now and it works. \$\endgroup\$ – kirtan09 Mar 27 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.