AI Command Lab // Flight Simulator
6D: Static Interruption
Initial AI Output (Fragile)
// AI-Generated Code: The Silent Killer
void OnEnable() {
GameManager.OnPause += ShowPauseMenu;
}
// Audit Fail: Where is OnDisable?
// When this object is destroyed, the GameManager
// still tries to talk to it, causing a MissingReferenceException.
Initial AI Prompt
"You ask the AI: "Use a static event to tell the UI when the game is paused.""
Pilot Comm Link
Mission Objective: A skilled Mechanic directs the AI to Unsubscribe. You command: "Ensure you unsubscribe from the static event when the object is disabled."
Optimized Protocol
void OnDisable() {
// Corrected: Hanging up the phone.
GameManager.OnPause -= ShowPauseMenu;
}