Tier 2
Series 106
106A: The Volatile Memory
"A variable like `public int score;` lives in RAM. When you quit the game, RAM is wiped. An Engineer understands that data must be written to the Hard Drive to survive a reboot."
The Concept: Persistence
The two lives of data:
* **Session:** Temporary (Health, Position). Lives in variables.
* **Persistent:** Permanent (High Score, Unlocks). Lives in files.
* **Rule:** You must manually "Save" (Write) and "Load" (Read).
* **Session:** Temporary (Health, Position). Lives in variables.
* **Persistent:** Permanent (High Score, Unlocks). Lives in files.
* **Rule:** You must manually "Save" (Write) and "Load" (Read).
Red Flag Detected
The AI Trap: "The Static Trap"
You ask the AI: "Make sure the score stays when I restart."
// AI-Generated Code: Misunderstanding Scope public static int highScore; // Audit Fail: "static" variables persist between SCENES, // but they are still wiped when the APPLICATION closes.
This is "The RAM Myth." The AI assumes you just mean "Changing Levels," not "Quitting the Game."
Elite Telemetry
Research shows "Elite" teams achieve 15% faster lead times by keeping AI on a "very tight leash."
- Small Batches Solving one problem at a time prevents logic drift.
- Modular Design Localizing the "blast radius" of AI changes.
- Tight Loops Rapid iteration with constant code review.
The Engineer's Correction
Corrective Protocol
// Corrected: Disk Write
PlayerPrefs.SetInt("HighScore", score);
PlayerPrefs.Save();
Your Pilot Command
> Direct the AI to use a Game Manager with a Singleton pattern for global state control.