### Full SimpleUsage MonoBehaviour example Source: https://github.com/bayatgames/savegamefree/wiki/Home Complete Unity MonoBehaviour example that saves an integer score on application quit using SaveGame.Save. Includes necessary using directives and the BayatGames.SaveGameFree namespace. ```csharp using System.Collections; using System.Collections.Generic; using UnityEngine; using BayatGames.SaveGameFree; public class SimpleUsage : MonoBehaviour { public int score; void OnApplicationQuit () { SaveGame.Save ( "score", score ); } } ``` -------------------------------- ### Full Example: Save and Load with Default Value Source: https://github.com/bayatgames/savegamefree/blob/master/README.md Complete MonoBehaviour example that saves the score on application quit and loads it on start, using a default value of 0 when no saved data exists. Requires the Bayat.Unity.SaveGameFree namespace. ```csharp using System.Collections; using System.Collections.Generic; using UnityEngine; using Bayat.Unity.SaveGameFree; public class SimpleUsage : MonoBehaviour { public int score; void OnApplicationQuit() { SaveGame.Save("score", score); } void Start() { // Load with default value score = SaveGame.Load("score", 0); } } ``` -------------------------------- ### Commit Example: docs with body Source: https://github.com/bayatgames/savegamefree/blob/master/CONTRIBUTING.md Example of a documentation commit with a body about adding async examples. ```text docs: update README with async examples Add code examples showing how to use the new async methods. ``` -------------------------------- ### Commit Example: feat with body and footer Source: https://github.com/bayatgames/savegamefree/blob/master/CONTRIBUTING.md Example of a feature commit with a body and closing issue footer. ```text feat: add async save and load methods Add SaveAsync and LoadAsync methods for non-blocking file operations. This improves performance when saving large files. Closes #123 ``` -------------------------------- ### Basic Save with SaveGame.Save Source: https://github.com/bayatgames/savegamefree/blob/master/README.md Saves an integer value under a specified key. Use this minimal call for quick saves without additional setup. ```csharp SaveGame.Save("score", score); ``` -------------------------------- ### Save an integer value with SaveGame.Save Source: https://github.com/bayatgames/savegamefree/wiki/Home Minimal usage example showing how to save a score value using SaveGame.Save with the key "score". ```csharp SaveGame.Save ( "score", score ); ``` -------------------------------- ### C# SaveAsync Example Source: https://github.com/bayatgames/savegamefree/blob/master/CONTRIBUTING.md Example of a public async method with XML documentation, using statement, and exception handling. Uses string interpolation for error messages. ```csharp /// /// Saves data asynchronously using the identifier. /// /// Unique identifier for the save data. /// The object to save. /// The type of object to save. public static async Task SaveAsync(string identifier, T objToSave) { ValidateIdentifier(identifier); try { using (var stream = new MemoryStream()) { // Implementation } } catch (Exception ex) { string errorMsg = $"Failed to save data with identifier '{identifier}': {ex.Message}"; throw new InvalidOperationException(errorMsg, ex); } } ``` -------------------------------- ### Commit Example: fix with body Source: https://github.com/bayatgames/savegamefree/blob/master/CONTRIBUTING.md Example of a bug fix commit with a body explaining resource disposal. ```text fix: prevent stream resource leaks Implement using statements for all stream operations to ensure proper resource disposal. ``` -------------------------------- ### Git URL for UPM Installation Source: https://github.com/bayatgames/savegamefree/blob/master/README_PROJECT.md The Git URL to add in Unity Package Manager for installing the Save Game Free package via 'Add package from git URL'. ```text https://github.com/BayatGames/SaveGameFree.git?path=/Assets/BayatGames/SaveGameFree ``` -------------------------------- ### Save Game Free basic save usage with SaveGame.Save Source: https://github.com/bayatgames/savegamefree/blob/master/Assets/BayatGames/SaveGameFree/Documentation~/Save Game Free Documentation - Microsoft Word Version.docx Shows a minimal Unity C# example of saving an integer value using SaveGame.Save with the identifier "score". Call this in a MonoBehaviour's Start method to persist the value. ```csharp using System.Collections; using System.Collections.Generic; using UnityEngine; public class Example { public int score; void Start () { SaveGame.Save ( "score", score ); } } ``` -------------------------------- ### Command Line Test Runner Command Source: https://github.com/bayatgames/savegamefree/blob/master/README_PROJECT.md Runs EditMode tests from the command line using Unity's test runner. ```bash Unity -runTests -testPlatform EditMode ``` -------------------------------- ### Commit Example: breaking change with BREAKING CHANGE footer Source: https://github.com/bayatgames/savegamefree/blob/master/CONTRIBUTING.md Example of a breaking change commit using the ! suffix and BREAKING CHANGE footer. ```text refactor!: replace hardcoded password with device-specific generation BREAKING CHANGE: Default encryption password is now device-specific. Users relying on the default password need to set a custom password. ``` -------------------------------- ### Package Location Path Source: https://github.com/bayatgames/savegamefree/blob/master/README_PROJECT.md Specifies the root directory of the Save Game Free package within the Unity project. ```text Assets/BayatGames/SaveGameFree/ ``` -------------------------------- ### UPM Package Directory Structure Source: https://github.com/bayatgames/savegamefree/blob/master/README_PROJECT.md Shows the recommended Unity Package Manager layout for the Save Game Free package, including runtime, editor, tests, samples, and documentation folders. ```text Assets/BayatGames/SaveGameFree/ ├── package.json # Package manifest ├── README.md # Package documentation ├── CHANGELOG.md # Version history ├── LICENSE # MIT License ├── Runtime/ # Runtime code │ ├── io.bayat.savegamefree.asmdef │ ├── SaveGame.cs │ ├── SaveGameWeb.cs │ ├── SaveGameAuto.cs │ ├── SaveGamePath.cs │ ├── Serializers/ │ ├── Encoders/ │ └── Types/ ├── Editor/ # Editor-only code │ └── Tests/ ├── Tests/ # Test assemblies │ └── Editor/ │ ├── io.bayat.savegamefree.Editor.Tests.asmdef │ ├── SaveGameTests.cs │ └── SaveGameExtendedTests.cs ├── Samples~/ # Package samples (ignored by Unity) ├── Documentation~/ # Documentation files (ignored by Unity) ├── Plugins/ # Third-party plugins └── Web/ # WebGL-specific resources ``` -------------------------------- ### Encryption Password Change - Before Source: https://github.com/bayatgames/savegamefree/blob/master/CHANGELOG.md Shows the previous default encryption password usage before the change. The default password was "h@e#ll$o%^" for all installations. ```csharp // Default password was "h@e#ll$o%^" for all installations SaveGame.Save("data", myData, encode: true); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, Encoding encoding) - Example Source: https://github.com/bayatgames/savegamefree/wiki/API Example of saving a string with UTF-8 encoding. ```csharp SaveGame.Save ("myString", "Hello, World!", Encoding.UTF8); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, ISaveGameSerializer serializer) - Example Source: https://github.com/bayatgames/savegamefree/wiki/API Example of saving a string with SaveGameXmlSerializer. Use the same serializer for saving and loading to avoid errors. ```csharp SaveGame.Save ("myString", "Hello World", new SaveGameXmlSerializer ()); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, string encodePassword) - Example Source: https://github.com/bayatgames/savegamefree/wiki/API Example of saving a float with the encoding password '12345UP'. ```csharp SaveGame.Save ("time", 123f, "12345UP"); ``` -------------------------------- ### Async Usage with SaveAsync and LoadAsync Source: https://github.com/bayatgames/savegamefree/blob/master/README.md Recommended for large save files to avoid blocking the main thread. Uses async/await with SaveGame.SaveAsync and SaveGame.LoadAsync, including a default value of 0 on load. ```csharp using System.Threading.Tasks; using UnityEngine; using Bayat.Unity.SaveGameFree; public class AsyncUsage : MonoBehaviour { public int score; async void OnApplicationQuit() { await SaveGame.SaveAsync("score", score); } async void Start() { score = await SaveGame.LoadAsync("score", 0); } } ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, bool encode) - Example Source: https://github.com/bayatgames/savegamefree/wiki/API Examples of saving with and without encryption. Encrypted data must be loaded with encryption enabled, otherwise loading may fail. ```csharp SaveGame.Save ("encryptedInt", 12, true); // Save data with encryption SaveGame.Save ("normalInt", 15, false); // Save data without encryption ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, ISaveGameEncoder encoder) - Example Source: https://github.com/bayatgames/savegamefree/wiki/API Example of saving an int with SaveGameSimpleEncoder. Use the same encoder for saving and loading to avoid unexpected behaviors. ```csharp SaveGame.Save ("score", 125, new SaveGameSimpleEncoder ()); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj) - Example Source: https://github.com/bayatgames/savegamefree/wiki/API Example of saving a Vector3Save object with the identifier 'myVector'. ```csharp SaveGame.Save ("myVector", new Vector3Save (1f, 2f, 3f)); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, SaveGamePath savePath) - Example Source: https://github.com/bayatgames/savegamefree/wiki/API Example of saving a Vector2Save to the DataPath. Use the same Save Path for saving and loading, otherwise the data cannot be loaded. ```csharp SaveGame.Save ("myVector", new Vector2Save (12f, 42f), SaveGamePath.DataPath); ``` -------------------------------- ### Encryption Usage with EncodePassword and encode Parameter Source: https://github.com/bayatgames/savegamefree/blob/master/README.md Enables encryption for sensitive data. Set SaveGame.EncodePassword to a custom secure password, then pass encode: true to Save and Load methods. The password is required for both saving and loading encrypted data. ```csharp // Set a custom password (IMPORTANT: Use your own secure password!) SaveGame.EncodePassword = "YourSecurePassword123!"; // Save with encryption SaveGame.Save("playerData", sensitiveData, encode: true); // Load with encryption var data = SaveGame.Load("playerData", defaultValue: "", encode: true); ``` -------------------------------- ### SaveGame.Save usage example Source: https://github.com/bayatgames/savegamefree/wiki/API Saves a string object with encryption enabled, using SaveGameJsonSerializer, SaveGameSimpleEncoder, UTF-8 encoding, and the DataPath save path. ```csharp SaveGame.Save ("myString", "Hello, World!", true, "12345", new SaveGameJsonSerializer (), new SaveGameSimpleEncoder (), Encoding.UTF8, SaveGamePath.DataPath); ``` -------------------------------- ### Namespace Change: After Source: https://github.com/bayatgames/savegamefree/blob/master/Assets/BayatGames/SaveGameFree/CHANGELOG.md New namespace imports following Unity naming conventions. Update all using statements to these. ```csharp using Bayat.Unity.SaveGameFree; using Bayat.Unity.SaveGameFree.Serializers; using Bayat.Unity.SaveGameFree.Encoders; using Bayat.Unity.SaveGameFree.Types; ``` -------------------------------- ### Namespace Change: Before Source: https://github.com/bayatgames/savegamefree/blob/master/Assets/BayatGames/SaveGameFree/CHANGELOG.md Old namespace imports used in previous versions of SaveGameFree. Replace these with the new Bayat.Unity namespace. ```csharp using BayatGames.SaveGameFree; using BayatGames.SaveGameFree.Serializers; using BayatGames.SaveGameFree.Encoders; using BayatGames.SaveGameFree.Types; ``` -------------------------------- ### IOSupported() Method Removal - Before Source: https://github.com/bayatgames/savegamefree/blob/master/CHANGELOG.md Shows the deprecated IOSupported() method usage before removal. This method checked for platform file I/O support but is no longer needed. ```csharp if (SaveGame.IOSupported()) { SaveGame.Save("data", myData); } ``` -------------------------------- ### SaveGame.Save method syntax Source: https://github.com/bayatgames/savegamefree/wiki/API Shows the full method signature for SaveGame.Save with all parameters: identifier, obj, encode, password, serializer, encoder, encoding, and savePath. ```csharp SaveGame.Save (string identifier, T obj, bool encode, string password, ISaveGameSerializer serializer, ISaveGameEncoder encoder, Encoding encoding, SaveGamePath savePath); ``` -------------------------------- ### Asynchronous Save Method Source: https://github.com/bayatgames/savegamefree/blob/master/CHANGELOG.md Shows the new async SaveAsync method, recommended for large files to improve performance. ```csharp async Task SaveDataAsync() { await SaveGame.SaveAsync("data", myData); } ``` -------------------------------- ### IOSupported() Method Removal - After Source: https://github.com/bayatgames/savegamefree/blob/master/CHANGELOG.md Shows the simplified usage after removing IOSupported(). The library handles platform compatibility automatically, so you can call SaveGame.Save directly. ```csharp // Simply use Save/Load directly // The library handles platform compatibility automatically SaveGame.Save("data", myData); ``` -------------------------------- ### LevelManager class with SaveGame Free Source: https://github.com/bayatgames/savegamefree/wiki/Tutorial:-How-to-Create-Level-Management? Implements a singleton LevelManager that manages a dictionary of levels, saves and loads progress using SaveGame.Save and SaveGame.Load with the key "levels". Provides methods to set level unlocked/completed status and retrieve level data. ```csharp using System.Collections; using System.Collections.Generic; using UnityEngine; using BayatGames.SaveGameFree; public class LevelManager : MonoBehaviour { private static LevelManager m_Singleton; public static LevelManager Singleton { get { return m_Singleton; } } protected Dictionary m_Levels; void Awake () { if ( m_Singleton != null ) { Destroy ( gameObject ); return; } m_Singleton = this; m_Levels = new Dictionary (); // Adding default levels for ( int i = 0; i < 100; i++ ) { m_Levels.Add ( i, new Level () ); } Load (); } void OnApplicationQuit () { Save (); } void Save () { SaveGame.Save> ( "levels", m_Levels ); } void Load () { m_Levels = SaveGame.Load> ( "levels" ); } public void SetLevelUnlocked ( int id, bool unlock ) { if ( HasLevel ( id ) ) { Level level = m_Levels [ id ]; level.unlocked = unlock; m_Levels [ id ] = level; } } public void SetLevelCompleted ( int id, bool complete ) { if ( HasLevel ( id ) ) { Level level = m_Levels [ id ]; level.completed = complete; m_Levels [ id ] = level; } } public Level GetLevel ( int id ) { Level level; m_Levels.TryGetValue ( id, out level ); return level; } public bool HasLevel ( int id ) { return m_Levels.ContainsKey ( id ); } } ``` -------------------------------- ### Synchronous Save Method Source: https://github.com/bayatgames/savegamefree/blob/master/CHANGELOG.md Shows the synchronous Save method, which is still supported. Use this for simple save operations. ```csharp void SaveData() { SaveGame.Save("data", myData); } ``` -------------------------------- ### Encryption Password Change - After Source: https://github.com/bayatgames/savegamefree/blob/master/CHANGELOG.md Shows the new approach where the default password is unique per device/application. For production, always set your own password using SaveGame.EncodePassword. ```csharp // Default password is now unique per device/application // For production, ALWAYS set your own password: SaveGame.EncodePassword = "YourSecurePassword123!"; SaveGame.Save("data", myData, encode: true); ``` -------------------------------- ### Level struct definition Source: https://github.com/bayatgames/savegamefree/wiki/Tutorial:-How-to-Create-Level-Management? Defines the Level struct with completed and unlocked boolean fields. Used to represent the state of each level in the save system. ```csharp public struct Level { public bool completed; public bool unlocked; } ``` -------------------------------- ### Conventional Commits Format Source: https://github.com/bayatgames/savegamefree/blob/master/CONTRIBUTING.md Commit messages must follow the Conventional Commits specification with type, optional scope, description, and optional body/footer. ```text [optional scope]: [optional body] [optional footer(s)] ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, ISaveGameSerializer serializer) - Syntax Source: https://github.com/bayatgames/savegamefree/wiki/API Syntax for the Save overload that uses a custom serializer. ```csharp SaveGame.Save (string identifier, T obj, ISaveGameSerializer serializer); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, bool encode, string password, ISaveGameSerializer serializer, ISaveGameEncoder encoder, Encoding encoding, SaveGamePath savePath) Source: https://github.com/bayatgames/savegamefree/wiki/API Saves an object using the specified parameters. This method allows you to save any serializable object with configurable serialization, encryption, encoding, and save path options. ```APIDOC ## SaveGame.Save (string identifier, T obj, bool encode, string password, ISaveGameSerializer serializer, ISaveGameEncoder encoder, Encoding encoding, SaveGamePath savePath) ### Description Saves the object with using the specified parameters. ### Parameters - **identifier** (string) - The identifier. - **obj** (T) - The object to save. - **encode** (bool) - Whether to encode the data or not. (Encryption) - **password** (string) - The encoding password. (Encryption) - **serializer** (ISaveGameSerializer) - The serializer to use for serialization. - **encoder** (ISaveGameEncoder) - The encoder, which encryption method to use. - **encoding** (Encoding) - The character encoding to use. - **savePath** (SaveGamePath) - The save path, where to save the data. ### Syntax ```csharp SaveGame.Save (string identifier, T obj, bool encode, string password, ISaveGameSerializer serializer, ISaveGameEncoder encoder, Encoding encoding, SaveGamePath savePath); ``` ### Request Example ```csharp SaveGame.Save ("myString", "Hello, World!", true, "12345", new SaveGameJsonSerializer (), new SaveGameSimpleEncoder (), Encoding.UTF8, SaveGamePath.DataPath); ``` ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, bool encode) - Syntax Source: https://github.com/bayatgames/savegamefree/wiki/API Syntax for the Save overload that includes an encode flag for encryption. ```csharp SaveGame.Save (string identifier, T obj, bool encode); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, string encodePassword) - Syntax Source: https://github.com/bayatgames/savegamefree/wiki/API Syntax for the Save overload that uses a custom encoding password. Encoding must be enabled by default to use encodePassword. ```csharp SaveGame.Save (string identifier, T obj, string encodePassword); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, SaveGamePath savePath) - Syntax Source: https://github.com/bayatgames/savegamefree/wiki/API Syntax for the Save overload that specifies a save path. ```csharp SaveGame.Save (string identifier, T obj, SaveGamePath savePath); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, ISaveGameEncoder encoder) - Syntax Source: https://github.com/bayatgames/savegamefree/wiki/API Syntax for the Save overload that uses a custom encoder for encryption. ```csharp SaveGame.Save (string identifier, T obj, ISaveGameEncoder encoder); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj, Encoding encoding) - Syntax Source: https://github.com/bayatgames/savegamefree/wiki/API Syntax for the Save overload that specifies a character encoding. ```csharp SaveGame.Save (string identifier, T obj, Encoding encoding); ``` -------------------------------- ### SaveGame.Save (string identifier, T obj) - Syntax Source: https://github.com/bayatgames/savegamefree/wiki/API Syntax for the basic Save overload that saves an object with an identifier. ```csharp SaveGame.Save (string identifier, T obj); ``` -------------------------------- ### SaveGame.Save(string identifier, T obj, string encodePassword) Source: https://github.com/bayatgames/savegamefree/wiki/API Saves the given object with the given identifier, by the given encoding password. The encoding must be enabled by default to use encodePassword. ```APIDOC ## SaveGame.Save(string identifier, T obj, string encodePassword) ### Description Saves the given object with the given identifier, by the given encoding password. The encoding must be enabled by default to use **encodePassword**. ### Parameters - **identifier** (string) - Required - The identifier. - **obj** (T) - Required - The object to save. - **encodePassword** (string) - Required - The encoding password. (Encryption) ### Syntax ```csharp SaveGame.Save (string identifier, T obj, string encodePassword); ``` ### Example ```csharp SaveGame.Save ("time", 123f, "12345UP"); ``` ``` -------------------------------- ### SaveGame.Save(string identifier, T obj, Encoding encoding) Source: https://github.com/bayatgames/savegamefree/wiki/API Save the given object with the given identifier with the specified character encoding. ```APIDOC ## SaveGame.Save(string identifier, T obj, Encoding encoding) ### Description Save the given object with the given identifier with the specified character encoding. ### Parameters - **identifier** (string) - Required - The identifier. - **obj** (T) - Required - The object to save. - **encoding** (Encoding) - Required - The character encoding to use. ### Syntax ```csharp SaveGame.Save (string identifier, T obj, Encoding encoding); ``` ### Example ```csharp SaveGame.Save ("myString", "Hello, World!", Encoding.UTF8); ``` ``` -------------------------------- ### SaveGame.Load Source: https://github.com/bayatgames/savegamefree/blob/master/Assets/BayatGames/SaveGameFree/Documentation~/Save Game Free Documentation - Microsoft Word Version.docx Loads an object of type T from the specified identifier, returning a default value if the identifier does not exist. This method is part of the Save Game Free API for retrieving saved game data. ```APIDOC ## SaveGame.Load (string identifier, T defaultValue) ### Description Loads the object associated with `identifier`, or returns `defaultValue` if not found. ### Method Load ### Parameters - **identifier** (string) - Required - The identifier. - **defaultValue** (T) - Required - The default value. ### Example ```csharp int score = SaveGame.Load("score", 0); ``` ``` -------------------------------- ### SaveGame.Save(string identifier, T obj, ISaveGameSerializer serializer) Source: https://github.com/bayatgames/savegamefree/wiki/API Saves the given object with the given identifier and uses the given serializer for serialization. ```APIDOC ## SaveGame.Save(string identifier, T obj, ISaveGameSerializer serializer) ### Description Saves the given object with the given identifier and uses the given serializer for serialization. ### Parameters - **identifier** (string) - Required - The identifier. - **obj** (T) - Required - The object to save. - **serializer** (ISaveGameSerializer) - Required - The serializer to use for serialization. ### Syntax ```csharp SaveGame.Save (string identifier, T obj, ISaveGameSerializer serializer); ``` ### Example ```csharp SaveGame.Save ("myString", "Hello World", new SaveGameXmlSerializer ()); ``` ### Notes Make sure to use same serializers for saving and loading, otherwise you might experience some errors. ``` -------------------------------- ### SaveGame.Save(string identifier, T obj, bool encode) Source: https://github.com/bayatgames/savegamefree/wiki/API Saves the given object with the given identifier and encodes the result if encoding is enabled. ```APIDOC ## SaveGame.Save(string identifier, T obj, bool encode) ### Description Saves the given object with the given identifier and encodes the result if encoding is enabled. ### Parameters - **identifier** (string) - Required - The identifier. - **obj** (T) - Required - The object to save. - **encode** (bool) - Required - Whether to encode the data or not. (Encryption) ### Syntax ```csharp SaveGame.Save (string identifier, T obj, bool encode); ``` ### Example ```csharp SaveGame.Save ("encryptedInt", 12, true); // Save data with encryption SaveGame.Save ("normalInt", 15, false); // Save data without encryption ``` ### Notes Make sure to load the encrypted data with encryption enabled, otherwise the data can't be loaded and this might cause problem. ``` -------------------------------- ### SaveGame.Save(string identifier, T obj, SaveGamePath savePath) Source: https://github.com/bayatgames/savegamefree/wiki/API Saves the given object with the given identifier at the given path. ```APIDOC ## SaveGame.Save(string identifier, T obj, SaveGamePath savePath) ### Description Saves the given object with the given identifier at the given path. ### Parameters - **identifier** (string) - Required - The identifier. - **obj** (T) - Required - The object to save. - **savePath** (SaveGamePath) - Required - The save path, where to save the data. ### Syntax ```csharp SaveGame.Save (string identifier, T obj, SaveGamePath savePath); ``` ### Example ```csharp SaveGame.Save ("myVector", new Vector2Save (12f, 42f), SaveGamePath.DataPath); ``` ### Notes Make sure to use same Save Path for both saving and loading, otherwise the data can't be loaded. ``` -------------------------------- ### SaveGame.Save(string identifier, T obj) Source: https://github.com/bayatgames/savegamefree/wiki/API Saves the given object with the given identifier. ```APIDOC ## SaveGame.Save(string identifier, T obj) ### Description Saves the given object with the given identifier. ### Parameters - **identifier** (string) - Required - The identifier. - **obj** (T) - Required - The object to save. ### Syntax ```csharp SaveGame.Save (string identifier, T obj); ``` ### Example ```csharp SaveGame.Save ("myVector", new Vector3Save (1f, 2f, 3f)); ``` ``` -------------------------------- ### SaveGame.Save(string identifier, T obj, ISaveGameEncoder encoder) Source: https://github.com/bayatgames/savegamefree/wiki/API Saves the given object with the given identifier and uses the given encoder for encryption. ```APIDOC ## SaveGame.Save(string identifier, T obj, ISaveGameEncoder encoder) ### Description Saves the given object with the given identifier and uses the given encoder for encryption. ### Parameters - **identifier** (string) - Required - The identifier. - **obj** (T) - Required - The object to save. - **encoder** (ISaveGameEncoder) - Required - The encoder, which encryption method to use. ### Syntax ```csharp SaveGame.Save (string identifier, T obj, ISaveGameEncoder encoder); ``` ### Example ```csharp SaveGame.Save ("score", 125, new SaveGameSimpleEncoder ()); ``` ### Notes Make sure to use same encoder for both saving and loading, otherwise you might experience unexcepted behaviours. ``` -------------------------------- ### SaveGame.Save Source: https://github.com/bayatgames/savegamefree/blob/master/Assets/BayatGames/SaveGameFree/Documentation~/Save Game Free Documentation - Microsoft Word Version.docx Saves an object of type T to the specified identifier. This method is part of the Save Game Free API for persisting game data. ```APIDOC ## SaveGame.Save (string identifier, T obj) ### Description Saves the object `obj` under the given `identifier`. ### Method Save ### Parameters - **identifier** (string) - Required - The identifier. - **obj** (T) - Required - The object to save. ### Example ```csharp SaveGame.Save("score", score); ``` ```