我可以登录并打开排行榜,但是云存储和加载SavedGameRequestStatus
会以SaveGameOpened
方法返回InternalError。
我正在使用最新版本的PlayGameServices。我启用了在控制台中保存游戏的功能。
void AuthenticateUser()
{
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.EnableSavedGames().Build();
PlayGamesPlatform.DebugLogEnabled = false;
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
}
void OpenSave(bool saving)
{
Debug.Log("Open Save");
if (Social.localUser.authenticated)
{
issaving = saving;
((PlayGamesPlatform)Social.Active).SavedGame.OpenWithAutomaticConflictResolution(
saveName,
DataSource.ReadCacheOrNetwork,ConflictResolutionStrategy.UseLongestPlaytime,
SaveGameOpened
);
}
}
void SaveGameOpened(SavedGameRequestStatus status, ISavedGameMetadata meta)
{
Debug.Log("SaveGameOpened");
if (status == SavedGameRequestStatus.Success)
{
if (issaving) //write
{
byte[] data = System.Text.ASCIIEncoding.ASCII.GetBytes("test data");
SavedGameMetadataUpdate update = new SavedGameMetadataUpdate.Builder()
.WithUpdatedDescription("saved at" + DateTime.Now.ToString()).Build();
((PlayGamesPlatform)Social.Active).SavedGame
.CommitUpdate(meta,update,data,SaveUpdate);
}
else // read
{
((PlayGamesPlatform)Social.Active).SavedGame.ReadBinaryData(meta, SaveRead);
}
}
else
{
Debug.Log("SaveGameOpened Error Status = " + status);
}
}