원클릭으로
unity-save-load
Unity Save/Load and Data Persistence
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Unity Save/Load and Data Persistence
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Unity ScriptableObject Architecture
Unity Shaders
Unity State Machines
Registers new C# files in resources/manifests/<system>.json (files array + tests.editmode/playmode list) and validates with just validate-registry. Use when creating any new script, adding a new game system, or fixing 'orphan file' CI failures. Trigger phrases: 'add to manifest', 'register file', 'new system', 'validate registry'. Key capabilities: exact JSON manifest format, ACTIVE/DEPRECATED/EXPERIMENTAL status, dependency declarations, test class name mapping for pre-push gating via resolve_module_tests.py. Do NOT use for modifying physics logic or editing game scripts unrelated to registration.
Unity Terrain & Track Creation for RC Racing
Unity Testing, Debugging & QA
| name | unity-save-load |
| description | Unity Save/Load and Data Persistence |
Use this skill when implementing save/load systems, persisting game state to disk, managing PlayerPrefs, or building serialization pipelines for game data.
PlayerPrefs stores small amounts of data in OS-specific locations (registry on Windows, plist on macOS). Use for settings only, not game saves.
// Writing
PlayerPrefs.SetInt("HighScore", 9999);
PlayerPrefs.SetFloat("MasterVolume", 0.8f);
PlayerPrefs.SetString("PlayerName", "Totes");
PlayerPrefs.Save(); // flush to disk (automatic on Application.Quit)
// Reading (with defaults)
int highScore = PlayerPrefs.GetInt("HighScore", 0);
float volume = PlayerPrefs.GetFloat("MasterVolume", 1.0f);
string name = PlayerPrefs.GetString("PlayerName", "Player");
// Checking existence
if (PlayerPrefs.HasKey("MasterVolume")) { /* ... */ }
// Deleting
PlayerPrefs.DeleteKey("MasterVolume");
PlayerPrefs.DeleteAll(); // nuclear option — settings reset
Limitations:
Resources.Load is synchronous and convenient but has downsides:
// Load from Assets/Resources/
var prefab = Resources.Load<GameObject>("Prefabs/Enemy");
var texture = Resources.Load<Texture2D>("Textures/icon");
var all = Resources.LoadAll<AudioClip>("Audio/SFX");
Why to avoid Resources:
Files in Assets/StreamingAssets/ are included in the build as-is (not processed by Unity). Useful for raw config files, databases, or pre-built data.
// Read a file from StreamingAssets
string path = Path.Combine(Application.streamingAssetsPath, "config.json");
// Platform differences:
// Windows/Mac/Linux: file:// path, can use File.ReadAllText
// Android: jar:// path, must use UnityWebRequest
// WebGL: http:// path, must use UnityWebRequest
#if UNITY_ANDROID && !UNITY_EDITOR
// Android requires UnityWebRequest
using var www = UnityWebRequest.Get(path);
yield return www.SendWebRequest();
string json = www.downloadHandler.text;
#else
string json = File.ReadAllText(path);
#endif
| Method | Use Case | Pros | Cons |
|---|---|---|---|
| PlayerPrefs | Settings (volume, quality) | Simple, cross-platform | Not secure, no structured data |
| JsonUtility | Simple save data, no Dictionary | Fast, zero dependencies | Limited type support |
| Newtonsoft.Json | Complex save data, Dictionary, polymorphism | Full-featured | External dependency |
| Custom binary | Performance-critical or large saves | Small files, fast | Manual maintenance |
| Addressables | Asset loading (prefabs, textures, audio) | Async, memory-managed, CDN support | Setup complexity |
| Resources | Quick prototyping only | Simple API | Build bloat, no async |
| StreamingAssets | Raw files (configs, databases) | Unprocessed, platform-native | Platform-specific loading |
| ScriptableObject | Game data templates (items, enemies) | Editor-friendly, reusable | Not for mutable runtime state |