Hi, I’am having trouble with this, not sure why but i implemented leaderboards/achievements, but can’t even sign in to play services… here’s more info
-On my phone, when opening play services app, it shows the achievement list of my game which i can press play and it takes me to my game normally (so atleast i done something right)
-I’ve already configured the resources script with Windows > google play games
-This is my script for google play
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GooglePlayGames.BasicApi;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
public class PlayServices : MonoBehaviour {
[SerializeField]
bool dontDestroyOnLoad;
void Awake()
{
PlayGamesPlatform.Activate();
}
void Start()
{
if (dontDestroyOnLoad)
{
DontDestroyOnLoad(gameObject);
}
Social.localUser.Authenticate(success =>{});
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
SignIn();
}
void SignIn()
{
Debug.Log("Signing In to Play Services");
Social.localUser.Authenticate(success => {});
}
#region Achievements
public static void UnlockAchievement(string id)
{
Social.ReportProgress(id, 100, (bool success) =>
{
Debug.Log("Achievement " + id + " Unlocked");
});
}
public static void ShowAchievementsIU()
{
if (Social.localUser.authenticated)
{
Social.ShowAchievementsUI();
Debug.Log("Showing Achievements UI");
}
else
{
Social.localUser.Authenticate(success =>
{
});
}
}
#endregion /Achievements
#region Leaderboards
public static void AddScoreToLeaderboard(string leaderboardId, long score)
{
Social.ReportScore(score, leaderboardId, (bool success) =>
{
});
Debug.Log("Uploaded score: " + score + " to Leaderboard" + leaderboardId);
}
public static void ShowLeaderboardsUI()
{
if (Social.localUser.authenticated)
{
Social.ShowLeaderboardUI();
Debug.Log("Showing Leaderboard UI");
}
else
{
Social.localUser.Authenticate(success =>
{
});
}
}
#endregion /Leaderboards
}