Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

All Platforms Save - saves your game

Discussion in 'Assets and Asset Store' started by GleyGames, May 5, 2018.

  1. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    480
    All Platforms Save
    Simple way to save your game data
    social-media.jpg
    Get it from: Asset Store - All Platforms Save
    For detailed implementation instruction see the Documentation

    Available demos:
    Android | PC | WebGL


    Current version: 1.1.0

    Key features:

    • Easy to use: same line of code to save or load game data on all supported Unity platforms.
    • Game data can be saved using PlayerPrefs or external files.
    • Works on all Unity platforms without making any changes to the code.
    • Supports multiple save files.
    Currently supported save methods:
    • JSONSerializationFileSave -> serializes data using built-in JSON serializer and saves the result into an external file.
    • JSONSerializationPlayerPrefs -> serializes data using built-in JSON serializer and saves the result as a string using PlayerPrefs.
    • BinarySerializationFileSave -> serializes data using BinaryFormatter and saves the result into an external file.
    • BinarySerializationPlayerPrefs -> serializes data using the BinaryFormatter and saves the result as a string using PlayerPrefs.
    Easy setup using a Custom Editor Window:
    save window.png
    Easy to use methods available on all platforms:
    • Load:
    Code (CSharp):
    1. SaveManager.Instance.Load<T> (fullPath, DataWasLoaded,encrypt);
    2. private void DataWasLoaded(T data, SaveResult result, string message)
    3. {
    4.      if (result == SaveResult.Success)
    5.      {
    6.           // do something with your data
    7.      }
    8. }
    • Save:
    Code (CSharp):
    1. SaveManager.Instance.Save(T, fullPath, DataWasSaved,encrypt);
    2. private void DataWasSaved(SaveResult result, string message)
    3. {
    4.      if (result == SaveResult.Error)
    5.      {
    6.           //Do Something
    7.      }
    8. }
    • Clear specific save file:
    Code (CSharp):
    1. SaveManager.Instance.ClearFIle(filePath);
    • Clear all save files:
    Code (CSharp):
    1. SaveManager.Instance.ClearAllData(path);
    T can be any class marked as [Serializable] and can contain objects of other types of serializable classes.
    ex:

    Code (CSharp):
    1. [System.Serializable]
    2. public class GameValues
    3. {
    4.      public double version = 0;
    5.      public bool showVideo = true;
    6.      public int totalCoins = 0;
    7.      public float musicVolume = 1;
    8.      public string randomText = "Random Text";
    9.      public List<Level> levels = new List<Level>();
    10. }
    11.  
    12. [System.Serializable]
    13. public class Level
    14. {
    15.      public int levelNumber;
    16.      public float score;
    17. }


     
    Last edited: Feb 27, 2019
  2. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    480
    The All Platforms Save - 1.0.2 in now available on Asset Store.
    Changes in this version:
    • minor bug fixed.
    • added a namespace for the pack.
     
  3. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    480
    The All Platforms Save - 1.1.0 in now available on Asset Store.
    Two new methods for save to string and load from string added.
    • Save to string:
    Code (CSharp):
    1. SaveManager.Instance.SaveString(T, CompleteMethod, encrypt);
    2.  
    3. //this method will be called when save process is complete
    4. private void CompleteMethod(SaveResult result, string resultString)
    5. {
    6.      if (result == SaveResult.Error)
    7.      {
    8.           //Error
    9.      }
    10.      else
    11.      {
    12.           //save this string for later use, it contains all your game data
    13.           dataToLoadString = resultString;
    14.      }
    15. }
    • Load from string:
    Code (CSharp):
    1. SaveManager.Instance.LoadString(dataToLoadString, DataWasLoaded, encrypt);
    2.  
    3. private void DataWasLoaded(T data, SaveResult result, string message)
    4. {
    5.      if (result == SaveResult.Success)
    6.      {
    7.           // do something with your data
    8.      }
    9. }
     
  4. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    480
    We want to help all game developers, so we prepared 4 free vouchers for you.
    To get one send us an e-mail at gley.mobi@gmail.com
     
  5. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    480
    We still have 2 free vouchers, to get them you just have to ask for them at gley.mobi@gmail.com and they are yours.
     
  6. kmk68

    kmk68

    Joined:
    Feb 14, 2014
    Posts:
    44
    Hi.
    I have been using APS for some time and it's ok butI have one question: as soon as checking if the filethere? I have an application with a lot of files fromgame algorithms (programs) that he choosesplayer. At the beginning of the game I would like to updatelist of available files. I have to try to load tchem to check which ones are?

    Best regards,
    Kajetan
     
  7. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    480
    Hello,
    You can load all file from a specific folder and then loop through them and check which ones do you need. Let me know if that was not your question
     
    kmk68 likes this.
  8. jasa23

    jasa23

    Joined:
    Oct 26, 2018
    Posts:
    7
    Hello, I am wondering how to save bought items. So i bought the tool bundle and want to incorporate IAP with in game currency in order to buy certain items. With the use of IAP i can see that i can have a check and callback if the item was purchased, but does this also apply to in game currency or just real money? If so, how would i save the data that the user bough an item, would this all save function work, even if the user deletes the game? Should i rather implement it with google play services and the achievements? Thank you
     
  9. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    480
    Hello,
    Please take a look at this playlist about IAP:
    https://www.youtube.com/playlist?list=PLKeb94eicHQumyCLcJbprEgOhyKc2Q7EQ

    Part 4 covers saving and storing the products.
     
  10. blueibeast

    blueibeast

    Joined:
    Aug 2, 2019
    Posts:
    1
    Hello, I am trying to find a way to save a file in WebGL. I tried your asset and it looks like the file can only be saved at indexedDB using Application.persistentDataPath. Is there any way that I can define my custom path in the server so I can download the file later without playing WebGL by FTP?
     
  11. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    480
    Hello,
    You can serialize your data as a string using the asset and store that string wherever you want, even on your own server or a cloud based platform. If you want to save it locally only player prefs is possible.