{"id":28324368,"url":"https://github.com/recepilhanli/flexible-save-system","last_synced_at":"2026-05-16T22:35:03.839Z","repository":{"id":293858386,"uuid":"985332966","full_name":"recepilhanli/Flexible-Save-System","owner":"recepilhanli","description":"A flexible save system for Unity games, supporting JSON and Binary formats with slot-based management and dynamic listeners.","archived":false,"fork":false,"pushed_at":"2025-05-19T15:11:28.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-02T03:19:58.086Z","etag":null,"topics":["unity","unity-scripts"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/recepilhanli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-17T14:42:22.000Z","updated_at":"2025-05-19T15:11:31.000Z","dependencies_parsed_at":"2025-05-17T15:46:20.687Z","dependency_job_id":null,"html_url":"https://github.com/recepilhanli/Flexible-Save-System","commit_stats":null,"previous_names":["recepilhanli/flexible-save-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/recepilhanli/Flexible-Save-System","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recepilhanli%2FFlexible-Save-System","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recepilhanli%2FFlexible-Save-System/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recepilhanli%2FFlexible-Save-System/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recepilhanli%2FFlexible-Save-System/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/recepilhanli","download_url":"https://codeload.github.com/recepilhanli/Flexible-Save-System/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recepilhanli%2FFlexible-Save-System/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261495884,"owners_count":23167389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["unity","unity-scripts"],"created_at":"2025-05-25T18:10:39.859Z","updated_at":"2026-05-16T22:35:03.812Z","avatar_url":"https://github.com/recepilhanli.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Save System\n\n## Overview\n\nThis project is a flexible and extensible save system designed for Unity games. It supports different data types (JSON/Binary), offers slot-based save management, and allows dynamic addition and removal of save listeners.\n\n## Features\n\n- **Slot-Based Saving:** Supports multiple save slots.\n- **JSON and Binary Support:** Saves can be stored in JSON or Binary (GZip compressed) format.\n- **Dynamic Listener Management:** Easily save different data types using save listeners (SaveListener).\n- **Easy Integration:** Simple save and load operations through SaveManager.\n- **Unity Compatible:** Platform-independent save directory using `Application.persistentDataPath`.\n\n## Installation\n\n1. Add the project files to your Unity project.\n2. Install necessary NuGet packages (e.g., `Newtonsoft.Json`).\n3. Create your own data types and listeners using the `ISave\u003cT\u003e` interface.\n4. Add your custom `SavePool` to the `SaveManager` by calling `SaveManager.LoadAllSavePools()`. \n## Usage\n\n### Creating a Save Listener\n\n```csharp\nvar listener = new SaveListener\u003cMyDataType\u003e(\"myDataFile\", myDataObject);\n```\n\n### Saving\n\n```csharp\nSaveManager.SaveGame();\n```\n\n### Loading\n\n```csharp\nSaveManager.LoadGame(slotIndex);\n```\n\n### Changing Save Slot\n\n```csharp\nSaveManager.ChangeSaveSlot(newSlotIndex);\n```\n\n## File Structure\n\n- `SaveManager.cs`: Central manager for save and load operations.\n- `SaveManager.Json.cs`: JSON format save/load operations.\n- `SaveManager.Binary.cs`: Binary format save/load operations.\n- `SavePool.cs`: Pool of save listeners and bulk data management.\n- `SaveListener.cs`: Save listener that attaches to data objects.\n- `ISave.cs`: Interfaces for objects to be saved.\n\n## SavePool Initialization\n\nThe `SavePool` is initialized in the `SaveManager` class. For example, in the `LoadAllSavePools` method, a `SavePool` for a specific data type is created and added to the data pools dictionary:\n\n```csharp\nprivate static void LoadAllSavePools()\n{\n    SavePool\u003cStandMixer.MixerStandSaveData\u003e mixerStandPool = new SavePool\u003cStandMixer.MixerStandSaveData\u003e();\n    _dataPools.Add(nameof(StandMixer), mixerStandPool);\n}\n```\n\nYou can load all save pools by calling `SaveManager.LoadAllSavePools()`.\n\n## Loading Data\n\nWhen loading data, the `onLoaded` action in the `SavePool` is triggered. This action can be used to handle the loaded data as needed. For example:\n\n```csharp\nSavePool\u003cMyDataType\u003e.onLoaded += (data) =\u003e {\n    // Handle the loaded data\n    Debug.Log($\"Loaded data: {data}\");\n};\n```\n\nThis allows you to perform custom actions whenever data is loaded from a save file.\n\n## Switching to JSON\n\nTo switch to JSON format, you can use the Unity Scripting Symbols. Add `SAVE_SYSTEM_USE_JSON` to your project's scripting symbols in Unity. This will enable JSON serialization for saving and loading data.\n\n## License\n\nYou are free to use and modify this project as you wish.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecepilhanli%2Fflexible-save-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecepilhanli%2Fflexible-save-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecepilhanli%2Fflexible-save-system/lists"}