AI Command Lab // Flight Simulator
202E: The Profiler Check
Initial AI Output (Fragile)
// AI-Generated Code: Refactoring blindly
void Update() {
// Audit Fail: We don't know if "CalculatePath" is the slow part.
// Maybe "UpdateUI" is the actual problem?
CalculatePath();
UpdateUI();
}
Initial AI Prompt
"You ask the AI: "This script feels slow. Rewrite the math.""
Pilot Comm Link
Mission Objective: A skilled Pilot directs the AI to Add Telemetry. You command: "Wrap the major logic blocks in Profiler.BeginSample so we can see the cost in the Profiler."
Optimized Protocol
// Corrected: Measurable Logic
using UnityEngine.Profiling;
void Update() {
Profiler.BeginSample("AI_Pathing");
CalculatePath();
Profiler.EndSample();
Profiler.BeginSample("UI_Update");
UpdateUI();
Profiler.EndSample();
}