AI Command Lab // Flight Simulator

5E: Memory Leaks

Initial AI Output (Fragile)

// AI-Generated Code: A slow-motion memory leak
List<Vector3> flightPath = new List<Vector3>();

void Update() {
    // Audit Fail: This list grows by 60 items per second.
    // After 10 minutes, there are 36,000 points in memory.
    flightPath.Add(transform.position);
}

void OnDisable() {
    // Audit Fail: The list is never cleared. 
    // If the drone respawns, the old data is still there!
}

Initial AI Prompt

"You ask the AI: "Record the positions of the drone so we can draw a flight path.""

Pilot Comm Link

Mission Objective: Use the Unity Profiler to identify and eliminate the specific bottleneck.