AI Command Lab // Flight Simulator
204A: The Controller Graph
Initial AI Output (Fragile)
// AI-Generated Code: Slow & Brittle
void Update() {
// Audit Fail: String comparisons are slow (Garbage Creation).
// If you rename "Run" in the Animator, this code breaks silently.
animator.SetBool("Run", true);
}
Initial AI Prompt
"You ask the AI: "Play the Run animation.""
Pilot Comm Link
Mission Objective: A skilled Pilot directs the AI to use Hash IDs. You command: "Cache the Animator.StringToHash ID in Awake and use that integer for all updates."
Optimized Protocol
// Corrected: Optimized & Safe
int runID;
void Awake() => runID = Animator.StringToHash("Run");
void Update() => animator.SetBool(runID, true);