Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    58
    All Platforms Save
    Simple way to save your game data
    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:


    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: May 28, 2018
  2. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    58
    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:
    58
    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:
    58
    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:
    58
    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.