- Home /
 
               Question by 
               conguerror · Feb 21 at 09:21 AM · 
                jsongoogle playsave datagoogle play gamesgoogle  
              
 
              Google play save doesn't work
Good day! Does anyone know a thing or two about google play saves? I want to save JSON(string) into the cloud and it doesn't work. I narrowed down a problem and realized that a function is not called which is strange because in the tutorial that I watched everything worked. here is a code snippet with a comments and a function that is not invoked(I can send a whole script if needed also)
 public void OpenSaveToCloud(bool saving)
     {
        // debugtext.text = "hello";
         if(Social.localUser.authenticated)
         {
           debugtext.text = "Authorized and proceed to save";
             issaving = saving;
             ((PlayGamesPlatform)Social.Active).SavedGame.OpenWithAutomaticConflictResolution
                 (SAVE_NAME, GooglePlayGames.BasicApi.DataSource.ReadCacheOrNetwork,
                 ConflictResolutionStrategy.UseLongestPlaytime, SavedGameOpen);   //SavedGame open must be called
          }
          else{
              debugtext.text = "No  authentication";
          }
     }
  
     private void SavedGameOpen(SavedGameRequestStatus status, ISavedGameMetadata meta)//this function is not called
     {
         if(status == SavedGameRequestStatus.Success)
         {
            // debugtext.text = "hello in save1";
             if (issaving)//if is saving is true we are saving our data to cloud
             {
                 debugtext.text = "Saving....";
                 byte[] data = System.Text.ASCIIEncoding.ASCII.GetBytes(GetDataToStoreinCloud());
                 SavedGameMetadataUpdate update = new SavedGameMetadataUpdate.Builder().Build();
                 ((PlayGamesPlatform)Social.Active).SavedGame.CommitUpdate(meta, update, data, SaveUpdate);
             }
             else//if is saving is false we are opening our saved data from cloud
             {
                 debugtext.text = "Loading...";
                 ((PlayGamesPlatform)Social.Active).SavedGame.ReadBinaryData(meta, ReadDataFromCloud);
             }
         }
         else{
             debugtext.text = "Save request status broke";
         }
     }
 
 
 
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by conguerror · Feb 23 at 04:54 PM
So the answer lies in the start function. Please copy and paste exactly this if you are having some function not invoking in the Play services saves
   if (platform == null)
             {
                 PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().EnableSavedGames().Build();
                 PlayGamesPlatform.InitializeInstance(config);
                 PlayGamesPlatform.DebugLogEnabled = true;
                 platform = PlayGamesPlatform.Activate();
             }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                