The problem is that after restarting the app the achievements are not shown in Play Games. But if I go into the game, all previously obtained achievements are obtained back and displayed correctly. Also the achievements never show up in the account's total achievements.
Here's the achievement code, maybe I'm doing something wrong?
using AppsFlyerSDK;
#if GPG
using GooglePlayGames;
#endif
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SocialPlatforms;
public class Achievements : Singleton<Achievements>
{
public GameObject prefabErrorAuthentificate;
public event Action<bool> AuthenticatedEvt;
public bool IsAuthenticated => Social.localUser.authenticated;
private void Start()
{
#if STANDALONE
return;
#endif
#if UNITY_ANDROID && GPG
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
#endif
#if UNITY_IOS
UnityEngine.SocialPlatforms.GameCenter.GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif
Authenticate();
}
public void Authenticate()
{
#if STANDALONE
return;
#endif
DebugPlus.Log($"Achievements: Start authentificate", LogTypeGame.System);
Social.localUser.Authenticate(onProcessAuthentication);
}
public void LogOut()
{
#if UNITY_ANDROID
//PlayGamesPlatform.Instance.SignOut();
//AuthenticatedEvt?.Invoke(false);
#endif
}
private void onProcessAuthentication(bool result, string message)
{
DebugPlus.Log($"Achievements: ProcessAuthentication:{result} code:{message}", LogTypeGame.System);
AuthenticatedEvt?.Invoke(result);
if (!result)
{
GameManager.Instance.CreatePopup(prefabErrorAuthentificate);
}
}
public void ShowAchievement()
{
Social.ShowAchievementsUI();
}
public void Achivement(string ID)
{
#if STANDALONE
return;
#endif
if (!AchievementsList.Acievements.ContainsKey(ID))
{
DebugPlus.Log($"Achievements: don't find achievement in Database - '{ID}'", LogTypeGame.System);
return;
}
string idPlatform;
#if UNITY_ANDROID
idPlatform = AchievementsList.Acievements[ID].IDAndroid;
#else
idPlatform = AchievementsList.Acievements[ID].IDIOS;
#endif
if (idPlatform.Equals(string.Empty))
{
DebugPlus.Log($"Achievements '{ID}' - ID is empty", LogTypeGame.All);
return;
}
DebugPlus.Log($"Achievements: The addition of the achievement of '{ID}' (idPlatform:{idPlatform}) began", LogTypeGame.All);
Social.ReportProgress(idPlatform, 100.0f, (bool success) =>
{
if (!success)
{
DebugPlus.Log($"Achivement '{ID}' did not success", LogTypeGame.All);
}
else
{
DebugPlus.Log($"Achievements: Added achievement '{ID}' ", LogTypeGame.All);
var eventValues = new Dictionary<string, string>();
eventValues.Add(AFInAppEvents.CONTENT_ID, ID);
AppsFlyer.sendEvent(AFInAppEvents.ACHIEVEMENT_UNLOCKED, eventValues);
}
});
}
}
I've only recently started mastering the google SDKs, so any help, even basic, would be appreciated.I haven't found anything like this on the internet and I have no ideas, I would appreciate any help.