{"id":30753856,"url":"https://github.com/ryadel/sobackup","last_synced_at":"2025-09-04T09:06:43.191Z","repository":{"id":311083469,"uuid":"1042409336","full_name":"Ryadel/SOBackup","owner":"Ryadel","description":"Editor-only utility for Unity that backs up and restores ScriptableObject assets as GUID-named JSON files, with optional field-name remapping to survive refactors.","archived":false,"fork":false,"pushed_at":"2025-08-23T00:35:03.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-23T02:44:23.468Z","etag":null,"topics":["asset-guid","backup","csharp","data-migration","developer-tools","dotnet","editor-utility","game-development","guid","json","restore","schema-migration","scriptableobject","serialization","unity","unity-asset","unity-editor","unity-plugin","unity-serialization","unity-tools"],"latest_commit_sha":null,"homepage":"https://www.ryadel.com/en/sobackup-backup-restore-scriptableobjects-json-unity-editor/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ryadel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-22T01:19:40.000Z","updated_at":"2025-08-23T00:35:07.000Z","dependencies_parsed_at":"2025-08-23T02:44:26.307Z","dependency_job_id":"42952824-e69f-48cd-8654-60038abff914","html_url":"https://github.com/Ryadel/SOBackup","commit_stats":null,"previous_names":["ryadel/sobackuprestore","ryadel/sobackup"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Ryadel/SOBackup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ryadel%2FSOBackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ryadel%2FSOBackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ryadel%2FSOBackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ryadel%2FSOBackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ryadel","download_url":"https://codeload.github.com/Ryadel/SOBackup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ryadel%2FSOBackup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273581136,"owners_count":25131392,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["asset-guid","backup","csharp","data-migration","developer-tools","dotnet","editor-utility","game-development","guid","json","restore","schema-migration","scriptableobject","serialization","unity","unity-asset","unity-editor","unity-plugin","unity-serialization","unity-tools"],"created_at":"2025-09-04T09:02:15.787Z","updated_at":"2025-09-04T09:06:43.161Z","avatar_url":"https://github.com/Ryadel.png","language":"C#","readme":"# SOBackup — A Safety Net for Unity ScriptableObjects\n\nStop losing data on refactors with a GUID‑based JSON backup, restore **and diff** workflow.\n\nSOBackup is an Editor‑only utility to protect ScriptableObject data during schema changes. It backs up assets to pretty‑printed JSON (named by asset GUID) and restores values later via `EditorJsonUtility.FromJsonOverwrite`, with an optional field‑name remap (oldKey → newKey) to survive aggressive renames.\n\n\u003e Built by a Unity game developer, for fellow Unity devs who iterate fast and refuse to lose content.\n\n---\n\n## What’s new\n\n- **Per‑asset context menu (right‑click):** in the Project window, right‑click any `ScriptableObject` to quickly **Backup**, **Restore** or **Diff vs. Backup** just that asset. Ideal for focused edits and sanity checks without scanning whole folders.\n- **Diff vs. Backup:** preview the differences between the selected asset and its latest JSON backup **before** restoring. Changes are highlighted by **Added / Removed / Modified** keys, so you can verify exactly what will change.\n\n\u003e The classic project‑wide menu commands are still available and unchanged.\n\n---\n\n## Why\n\nUnity serializes by field name. Rename a `[SerializeField]`, change a type, or move classes around and your `.asset` data can “disappear” from the Inspector. Attributes like `[FormerlySerializedAs]` and `[MovedFrom]` help (use them!), but large refactors and multi‑branch merges still benefit from a belt‑and‑suspenders approach.\n\nSOBackup gives you a simple, inspectable, versionable JSON snapshot per asset that you can safely restore after the dust settles.\n\n---\n\n## What it does\n\n- Backup every `ScriptableObject` in a scope to `{GUID}.json`.\n- Restore values into existing assets using `FromJsonOverwrite`.\n- Optional key remap (e.g., `\"damage\" → \"baseDamage\"`) applied to JSON before restore.\n- Works with Inspector‑style serialization: `[SerializeField]`, lists, enums, nested data, and asset references (`{fileID, guid, type}`).\n- **Per‑asset actions via context menu:** backup/restore/diff a single asset directly from the Project window.\n- **Diff preview:** see Added / Removed / Modified fields compared to the selected backup, so you can review changes prior to restoring.\n\n---\n\n## Quick Start\n\n1) **Install**  \n   Drop `SOBackup.cs` into any `.../Editor/` folder (e.g., `Assets/Tools/Editor/`). No package or asmdef required (unless you prefer an editor‑only asmdef).\n\n2) **Backup (project‑wide)**  \n   In the Project window, select the folders you want to scan (or select none to scan all of `Assets/`).  \n   Menu: **Tools → Contrappasso → Backup ScriptableObjects to JSON…**\n\n3) **Refactor**  \n   Rename fields/classes/namespaces as needed. Prefer adding `[FormerlySerializedAs]` / `[MovedFrom]` where feasible.\n\n4) **(Optional) Field‑name remap**  \n   Edit the `keyRenames` dictionary inside `SOBackup` to map `old → new` field names before restoring.\n\n5) **Restore (project‑wide)**  \n   Menu: **Tools → Contrappasso → Restore ScriptableObjects from JSON…**  \n   Pick the backup folder with `{GUID}.json` files. Values are overwritten onto existing assets.\n\n6) **Per‑asset workflow (new)**  \n   - Right‑click a `ScriptableObject` in the Project window → **SOBackup** → choose **Backup**, **Restore**, or **Diff vs. Backup**.\n   - **Diff vs. Backup** opens a preview of changes (Added / Removed / Modified) so you can validate before applying a restore.\n\n---\n\n## How it works\n\n- **Backup:** Finds `t:ScriptableObject` assets under your folders; writes one JSON per asset, named by GUID to avoid path/rename issues.\n- **Restore:** Reads JSON, optionally rewrites keys, resolves the GUID back to an asset, and calls `EditorJsonUtility.FromJsonOverwrite`. Marks assets dirty and saves.\n- **Diff:** Loads the current asset state and the corresponding JSON backup, normalizes keys (after optional remap), and shows a minimal set‑difference view so you can spot Added / Removed / Modified fields at a glance.\n\nBecause everything is keyed by GUID, moving or renaming assets will not break the mapping.\n\n---\n\n## Best Practices\n\n- Project Settings → Editor: enable **Visible Meta Files** and **Force Text**.\n- Prefer private `[SerializeField]` + public properties to reduce future serialized name changes.\n- Keep `[FormerlySerializedAs]` and `[MovedFrom]` for a couple of releases after refactors.\n- For big migrations: **Backup → Refactor → Diff → Restore →** sanity‑check a few “sentinel” assets/scenes.\n\n---\n\n## Limitations\n\n- Only serializes Unity‑serializable data (public or `[SerializeField]`).\n- Overwrites values on existing assets; does not create new assets.\n- Incompatible type changes won’t magically deserialize; use migration code (`ISerializationCallbackReceiver`) when semantics change.\n- Diff shows structural/value differences in serialized data; it does not execute custom comparison logic or domain‑specific validations.\n\n---\n\n## FAQ\n\n**Do I have to put the script in `Assets/Editor`?**  \nAny folder named `Editor` under `Assets/` works (`Assets/Scripts/Editor`, `Assets/Tools/Editor`, etc.). With asmdefs, mark the assembly as Editor‑only. Alternatively, wrap the code with `#if UNITY_EDITOR`.\n\n**Does it handle asset references?**  \nYes. References are preserved in JSON as `{fileID, guid, type}` and re‑bound on restore.\n\n**Why JSON?**  \nIt’s transparent, diff‑friendly, greppable, and mirrors the Inspector’s serialization via `EditorJsonUtility`.\n\n---\n\n## Changelog\n\n- **[NEW] Per‑asset context menu (right‑click) for Backup / Restore / Diff.**\n- **[NEW] Diff vs. Backup to preview Added / Removed / Modified fields before restore.**\n\n---\n\n## License\n\nMIT. Use it, tweak it, ship it.\n\n---\n\n## Credits\n\nCreated for the game project **Contrappasso** to move faster without losing ScriptableObject data. If this saved you a headache, consider a ⭐ and share improvements!\n\n\n---\n\n## Credits\nCreated for my game project **Contrappasso** to move faster without losing ScriptableObject data. If this saved you a headache, consider a ⭐ and share improvements!\n* **GitHub repo**: https://github.com/Ryadel/SOBackup/\n* **Docs, demo and examples**: https://www.ryadel.com/en/sobackup-backup-restore-scriptableobjects-json-unity-editor/\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryadel%2Fsobackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryadel%2Fsobackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryadel%2Fsobackup/lists"}