• Manual
  • API Documentation
  • Guides
  • Configuring Settings

    Show / Hide Table of Contents
    • Introduction
    • Installation
    • Getting Started
    • Demos
    • The Save System API
    • Auto Save
    • Platforms
    • Security
    • Serialization
    • Supported Data Types
    • Migration
    • FAQ
    • Changelog
    • Extend
      • Overview
      • Converter
      • Encryption
      • Storage
    • Guides
      • Overview
      • Configuring Settings
      • Using Auto Save
      • Basic Saving and Loading
      • Saving and Loading Raw Data
      • Deleting the Data
      • Saving and Loading Images
      • Saving and Loading Scene Objects
      • Saving and Loading Assets
      • Saving and Loading Readonly Properties
    • Integrations
      • Overview
      • Google Play Games
      • Xbox Live
      • Bolt
      • Firebase
      • PlayFab
      • PlayMaker
      • Steam Auto-Cloud
      • Steamworks .NET
      • Facepunch Steamworks
      • Text Mesh Pro
    • Storage
      • Overview
      • Backup
      • Catalog
      • Meta Data
      • Built-in Storages
        • File
        • PlayerPrefs
        • Memory
      • Third-party Storages
        • Firebase
          • Realtime Database
          • Cloud Storage
          • Firestore
        • PlayFab
          • Entity Objects
          • Entity Files
          • User Data
        • Steam
          • Steamworks .NET
          • Facepunch Steamworks
        • Google Play
          • Saved Game
        • Xbox Live
          • Connected Storage

    Configuring Settings

    The settings preset or object allows you to configure some aspects of the Save System and control its behaviour. You can also modify the underlying serializer settings to customize the output and the behaviour of it. Here we will change and configure settings in depth, so let's get started.

    Warning

    After updating the Save System the default settings will be replaced, so in order to make sure you don't lose your own settings, just copy or duplicate the modified default settings preset and place it outside of the default folder and it'll be safe for updates and changes afterwards.

    Note

    Leaving the Serializer Settings Preset field as None causes the Save System to use the Default Serializer Settings Preset which is placed at Plugins/Bayat/Json/Resources/Bayat/Json/Settings

    Changing the Storage

    You can change the storage either by modifying the Storage Connection String field or by assigning a new Storage object to the SaveSystemSettings Storage property.

    Using Settings Preset

    You can do it by creating a new custom Save System Settings Preset file:

    Create Save System Settings Preset Menu

    And then modify the Storage Connection String based on the below syntax:

    <Storage Identifier>://<Parameter Name>=<Parameter Value>
    

    For example:

    playerprefs://
    

    Because we don't have any special parameters to give to the PlayerPrefs storage, we just ignore them, but for the File storage, we need to specify a path or a directory to place the save files, by the way you can check the full list of the PlayerPrefs storage parameters here.

    A new Save System Settings Preset

    Note

    You can also use contexual variables such as {0}, {1}, {2}, ... and so on to use important data here, you can find the full list of these variables inside the Default Settings window but for your ease, here is the full list of them:

    • {0} = Application.persistentDataPath
    • {1} = Application.dataPath
    • {2} = Application.streamingAssetsPath
    • {3} = Application.temporaryCachePath
    • {4} = Application.absoluteURL
    • {5} = Application.buildGUID
    • {6} = Application.companyName
    • {7} = Application.productName
    • {8} = Application.identifier
    • {9} = Application.version
    • {10} = Application.unityVersion

    Or you can modify the existing Default settings preset inside the Plugins/Bayat/SaveSystem/Resources/Bayat/SaveSystem/Settings folder:

    Default Save System Settings Preset

    Using Settings Object

    Note

    This approach is for intermediate users who can understand code and programming.

    You can either modify the default settings object or create a new one and pass it through the API methods:

    Default Settings Object

    SaveSystemSettings settings = SaveSystemSettings.DefaultSettings;
    
    // You can either instantiate a new instance of the target storage class
    settings.Storage = new LocalDiskStorage();
    
    // Or you can use the StorageFactory.FromConnectionString
    settings.Storage = StorageFactory.FromConnectionString("disk://path={0}");
    

    New Settings Object

    SaveSystemSettings newSettings = new SaveSystemSettings();
    
    // You can either instantiate a new instance of the target storage class
    newSettings.Storage = new LocalDiskStorage();
    
    // Or you can use the StorageFactory.FromConnectionString
    newSettings.Storage = StorageFactory.FromConnectionString("disk://path={0}");
    
    // And then path it through the API
    string identifier = "demo.dat";
    string sampleValue = "This is a sample value.";
    await SaveSystemAPI.SaveAsync("demo.dat", sampleValue, newSettings);
    
    Note

    Make sure to include using Bayat.SaveSystem.Storage at the top of your script.

    Changing Encryption Algorithm

    You can change the storage either by modifying the Encryption Algorithm Name field or by assigning a new Encryption Algorithm object to the SaveSystemSettings Storage property.

    The possible available encryption algorithms for Symmetric encryption are as below:

    • Aes or aes
    • DES or des
    • RC2 or rc2
    • TripleDES or tripledes

    Learn more about Symmetric Encryption here >

    Using Settings Preset

    You can do it by creating a new custom Save System Settings Preset file:

    Create Save System Settings Preset Menu

    And then modify the Encryption Algorithm Name to any of the available algorithms above, for example:

    des
    

    A new Save System Settings Preset

    Or you can modify the existing Default settings preset inside the Plugins/Bayat/SaveSystem/Resources/Bayat/SaveSystem/Settings folder:

    Default Save System Settings Preset

    Using Settings Object

    Note

    This approach is for intermediate users who can understand code and programming.

    You can either modify the default settings object or create a new one and pass it through the API methods:

    Default Settings Object

    SaveSystemSettings settings = SaveSystemSettings.DefaultSettings;
    
    string algName = "aes";
    
    // You can instantiate a new instance of the SaveSystemSymmetricEncryption class and pass in the algorithm name
    settings.EncryptionAlgorithm = new SaveSystemSymmetricEncryption(algName);
    
    // If you have a custom encryption implementation, you can assign it there instead of SaveSystemSymmetricEncryption
    

    New Settings Object

    SaveSystemSettings newSettings = new SaveSystemSettings();
    
    string algName = "aes";
    
    // You can instantiate a new instance of the SaveSystemSymmetricEncryption class and pass in the algorithm name
    newSettings.EncryptionAlgorithm = new SaveSystemSymmetricEncryption(algName);
    
    // If you have a custom encryption implementation, you can assign it there instead of SaveSystemSymmetricEncryption
    
    // And then path it through the API
    string identifier = "demo.dat";
    string sampleValue = "This is a sample value.";
    await SaveSystemAPI.SaveAsync("demo.dat", sampleValue, newSettings);
    
    Note

    Make sure to include using Bayat.SaveSystem.Security at the top of your script.

    Implementing a Custom Encryption Algorithm

    You can implement a custom encryption algorithm by implementing the ISaveSystemEncryption interface and also creating a new Crypto Stream class for the new encryption algorithm by extending the SaveSystemCryptoStream abstract class.

    Learn more about extending the Encryption >

    • Improve this Doc
    • 1 Comment
    In This Article
    • Changing the Storage
      • Using Settings Preset
      • Using Settings Object
        • Default Settings Object
        • New Settings Object
    • Changing Encryption Algorithm
      • Using Settings Preset
      • Using Settings Object
        • Default Settings Object
        • New Settings Object
      • Implementing a Custom Encryption Algorithm