- Home /
Setting up Google Play Services
Hi,
I was wondering if anyone could help me on this problem I'm having. I've written a script to allow me to sign in to google play services and also check the leaderboards. However when I go to sign in using my internal closed build Google Play pops up, the loading sign and then nothing happens. I've done a bit of research on forums and tried using both my upload certificate and app signing key over on google cloud platform however neither work. Would anyone be able to advise if it's my code below or any other suggestions? Thanks so much!
using UnityEngine;
using GooglePlayGames;
using UnityEngine.SceneManagement;
public class LeaderboardsController : MonoBehaviour
{
public static LeaderboardsController instance;
private const string LEADERBOARDS_SCORE = "CgpI5fOtyc7fEAIQaA";
private void Awake()
{
MakeSingleton();
}
void Start()
{
PlayGamesPlatform.Activate();
}
private void OnEnable()
{
SceneManager.sceneLoaded += LevelWasLoaded;
}
private void OnDisable()
{
SceneManager.sceneLoaded -= LevelWasLoaded;
}
private void LevelWasLoaded(Scene scene, LoadSceneMode mode)
{
if (SceneManager.GetSceneByName(PlayerPrefsScript.GetSelectedScene()).isLoaded)
{
ReportScore(PlayerPrefsScript.GetMediumScore());
}
}
void MakeSingleton()
{
if(instance == null)
{
instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
public void ConnectOrDisconnectOnGooglePlayGames()
{
if (Social.localUser.authenticated)
{
PlayGamesPlatform.Instance.SignOut();
}
else
{
Social.localUser.Authenticate((bool success) =>
{
});
}
}
public void OpenLeaderboardsScore()
{
if (Social.localUser.authenticated)
{
PlayGamesPlatform.Instance.ShowLeaderboardUI(LEADERBOARDS_SCORE);
}
}
void ReportScore(int score)
{
if (Social.localUser.authenticated)
{
Social.ReportScore(score, LEADERBOARDS_SCORE, (bool success) =>
{
});
}
}
}
Your answer
Follow this Question
Related Questions
Google Play Games Cloud Save - NullReferenceException when accessing GooglePlay SavedGame 0 Answers
Leaderboards and achievements not working -- Google Play Services 0 Answers
Zip Path Traversal Vulnerability 1 Answer
Google Play Services: Google Android Project or Github Plug-In? 0 Answers
How can I publish my game 64bit and 32 bit on google play 2019? 1 Answer