Performance: File-based save system
MEDIUM IMPACT
This concept affects the game's loading speed and responsiveness when saving or loading data from disk.
async Task SaveGameAsync() { string data = JsonUtility.ToJson(gameData); await Task.Run(() => File.WriteAllText(Application.persistentDataPath + "/savefile.json", data)); }
void SaveGame() {
string data = JsonUtility.ToJson(gameData);
File.WriteAllText(Application.persistentDataPath + "/savefile.json", data);
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous file save on main thread | N/A | N/A | Blocks frame update causing stutter | [X] Bad |
| Asynchronous file save on background thread | N/A | N/A | No blocking, smooth frame updates | [OK] Good |