playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.47k stars 966 forks source link

DataSource.ReadNetworkOnly not working - Able to read/write when offline #2219

Open andrelevi opened 6 years ago

andrelevi commented 6 years ago

I'm seeing the same issue as https://github.com/playgameservices/play-games-plugin-for-unity/issues/1254, with Unity 2018.1.1.f1 and v0.9.50.

I was using DataSource.ReadCacheOrNetwork for most of development, but recently switched to DataSource.ReadNetworkOnly. Opening saved games when offline still results in a SavedGameRequestStatus.Success event, unless the user is not authenticated. I've tested on a Google Pixel and Samsung S8 while in airplane mode. I've also deleted the existing cloud save data since switching to DataSource.ReadNetworkOnly, to ensure that there wasn't some sort of flag being stored in the saved data itself.

My test code looks like this:

PlayGamesPlatform.Instance.SavedGame.OpenWithAutomaticConflictResolution(
    SaveFileData.SaveFileName,
    DataSource.ReadNetworkOnly,
    ConflictResolutionStrategy.UseLongestPlaytime,
    OnSavedGameOpened
);

private void OnSavedGameOpened(SavedGameRequestStatus status, ISavedGameMetadata game)
{
    if (status != SavedGameRequestStatus.Success)
    {
      Debug.LogError($"{nameof(OnSavedGameOpened)} {status}");
      return;
    }

    Debug.Log($"{nameof(OnSavedGameOpened)} {status}");
}
Athomield commented 6 years ago

Yep, I have experienced this too.