AI Command Lab // Flight Simulator
101E: File I/O Safety
Initial AI Output (Fragile)
// AI-Generated Code: Guaranteed to Crash on Mobile
void SaveScore(string data) {
// Audit Fail: This path only exists on your PC.
File.WriteAllText("C:/Saves/score.txt", data);
}
Initial AI Prompt
"You ask the AI: "Save the player's score to a file.""
Pilot Comm Link
Mission Objective: Use the Interface IPointerClickHandler for cleaner UI interaction logic.
Optimized Protocol
// Corrected: Cross-Platform Safe
void SaveScore(string data) {
string path = Path.Combine(Application.persistentDataPath, "score.txt");
File.WriteAllText(path, data);
}