Hi there!
I made this script to post the score to my leaderboard, but for some reason the leaderboard UI opens but it says “No one in your circles has played (my project)”. Why isn’t the score posting?
using UnityEngine;
using System.Collections;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
public class PlayGames: MonoBehaviour {
// Use this for initialization
void Start ()
{
Social.localUser.Authenticate((bool success) => {
// handle success or failure
});
Social.ReportScore (54321, "CgXXXX3m-XXXXAI", (bool success) => {
});
Social.ShowLeaderboardUI();
}
}
Leaderboard ID partially hidden (so no one posts fake scores). Thank you so much!
corn
2
You need to initialize PlayGamesPlatform before authenticating.
GooglePlayGames.PlayGamesPlatform.Activate();
Social.localUser.Authenticate((bool success) => {
Debug.LogFormat("Authentication success : {0}", success);
});
YES, I FINALLY GOT IT
This is what I did, I’m sure some of this is redundant:
1: When to the Google Developer console and loaded up my APK as a Beta game
2: Went into the Google Developer console > Google services and created all new leaderboards.
3: Changed my game’s package name (com.DroidifyDevs.RocketTest)
4: Reinstalled Google Play pugin
5: Used this script:
using GooglePlayGames;
using UnityEngine;
using System.Collections;
public class PlayGamesWorksinRT2 : MonoBehaviour {
// Use this for initialization
void Start() {
PlayGamesPlatform.Activate();
Social.localUser.Authenticate((bool success) =>
{
if (success)
{
GoogleTest();
PlayGamesPlatform.Activate();
Social.ShowLeaderboardUI();
}
else
Debug.Log("Auth wrong :(");
});
PlayGamesPlatform.Activate();
Social.ReportScore(50, "CgxxxxxxxxxxxBQ", (bool success) => {
});
}
// Update is called once per frame
void Update () {
}
void GoogleTest() //Call GameOver whenever your game is... over, let say .. when your player got N amount of points or N amount of damage...
{
//if (actualScore >= 5000)
// winText.text = "Good Job";
Debug.Log("Activated, Auth begins");
PlayGamesPlatform.Activate();
Social.ReportScore(50, "CgXXXXXXXXXXBQ", (bool success) => {
});
PlayGamesPlatform.Activate();
Social.ShowLeaderboardUI();
}
}
So basically I reset anything that could be reset. Feeling damn proud of myself 