- Home /
Question by
TheShadyColombian · May 01, 2016 at 01:03 AM ·
google playgoogle play gamesleaderboard
How to Implement Google Play Games?
I've followed all the guides from the GitHub page but my game still doesn't show anything in Google Play Games. There's no errors or anything. I kind of want to have an update rolled out with leaderboards by Monday, so I would really appreciate any help.
Here's the main script I use to upload scores to GPG.
using UnityEngine;
using UnityEngine.Purchasing;
using System.Collections;
using System;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
public class GPG : MonoBehaviour {
public bool SignedIn;
// Use this for initialization
void Start () {
UnityEngine.Object.DontDestroyOnLoad(gameObject);
//Initialize Google Play Games Services
Authenticate();
}
// Update is called once per frame
void Update () {
}
public void Authenticate () {
// authenticate user:
Social.localUser.Authenticate((bool success) => {
// handle success or failure
SignedIn = true;
});
}
public void SubmitScore (int Score) {
if (!SignedIn) {
Authenticate();
} else {
//Submit the high score to GPG
Social.ReportScore(Score, "CgkIiIeYtM0eEAIQCg", (bool success) => {
// handle success or failure
});
}
}
public void UnlockAchievement () {
if (!SignedIn) {
Authenticate();
} else {
//Submit the high score to GPG
}
}
}
Comment