Tier 2
Series 106
106G: The Vault Exam
Capstone Exam
"The save system is failing. The high score resets when the game is closed, the inventory fails to load on Android, and the save file works on PC but crashes on Mac. Identify the three critical data failures."
Target Asset for Audit
FRAGILE_CODE_DETECTED
using UnityEngine;
using System.IO;
public class SaveSystem : MonoBehaviour {
// Audit Requirement: Lesson 106A (Persistence)
// Error 1: Static Variable
public static int HighScore;
public void SaveGame() {
// Audit Requirement: Lesson 106E (File Path)
// Error 2: Hardcoded Path
string path = "C:/GameData/save.json";
File.WriteAllText(path, "...");
}
public void LoadGame() {
// Audit Requirement: Lesson 106B (Keys)
// Error 3: Typo in Key
// Saved as "Gold", loading as "gold"
int gold = PlayerPrefs.GetInt("gold");
}
}