MuharremTozan/Agentic-Duel / .agent/skills/unity-data-persistence
unity-data-persistence
VerifiedRobust Save/Load system using Data Binding, Serializable DTOs, and swappable Data Service backends (File/JSON default). Supports per-entity GUID identity for saving multiple actors (player, inventory, enemies).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.3 KB |
| assets/code/FileDataService.cs.txt | markdown | 2.3 KB |
| assets/code/PersistenceCore.cs.txt | markdown | 3.4 KB |
| assets/code/SaveLoadManager.cs.txt | markdown | 1.4 KB |
| assets/code/SaveLoadSystem.cs.txt | markdown | 4.7 KB |
| references/guide.md | markdown | 4.4 KB |
assets/code/SaveLoadManager.cs.txt
View on GitHubusing UnityEngine;
using Standard.Patterns.Singleton; // Assumes previous skill is available
namespace Standard.Systems.Persistence {
[System.Serializable]
public class GameData {
public string PlayerName;
public int LastLevelIndex;
public Vector3 PlayerPosition;
}
/// <summary>
/// Central manager for saving and loading game state.
/// Inherits from PersistentSingleton to ensure availability across scenes.
/// </summary>
public class SaveLoadManager : PersistentSingleton<SaveLoadManager> {
private IDataService dataService;
public GameData CurrentData { get; private set; }
protected override void Awake() {
base.Awake();
// Defaulting to File/JSON setup
dataService = new FileDataService(new JsonSerializer());
CurrentData = new GameData();
}
public void SaveGame(string saveName = "DefaultSave") {
dataService.Save(saveName, CurrentData);
Debug.Log($"[SaveLoad] Status: Game Saved | Data: {saveName}");
}
public void LoadGame(string saveName = "DefaultSave") {
var loadedData = dataService.Load<GameData>(saveName);
if (loadedData != null) {
CurrentData = loadedData;
Debug.Log($"[SaveLoad] Status: Game Loaded | Data: {saveName}");
}
}
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |