I creating a new game for android using unity engin and I face this probelm in Google Play Game Service.
I take all necessary steps to save data in play game services to save player progress in the cloud. After uninstalling the game from the device, I notice that the Play Game Service keeps the game in my list as played, and there is progress there, but after reinstalling it, the API returns empty data with a success status.
The code:
PlayGamesPlatform.Instance.SavedGame.OpenWithAutomaticConflictResolution("Data",
DataSource.ReadCacheOrNetwork,
ConflictResolutionStrategy.UseLongestPlaytime, (status, metadata) =>
{
switch (status)
{
case SavedGameRequestStatus.Success:
PlayGamesPlatform.Instance.SavedGame.ReadBinaryData(metadata, (requestStatus, bytes) =>
{
switch (requestStatus)
{
case SavedGameRequestStatus.Success:
callback(JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(bytes)));
Debug.Log("Data loaded");
break;
default:
callback(null);
Debug.Log("Data failed to Load: "+ status.ToString());
break;
}
});
break;
default:
callback(null);
Debug.Log("Data failed to Load: "+ status.ToString());
break;
}
});