AI Command Lab // Flight Simulator
206E: The Audio Pool
Initial AI Output (Fragile)
// AI-Generated Code: GC Spike
void OnCollisionEnter(Collision c) {
// Audit Fail: Creates and Destroys a GameObject every frame.
AudioSource.PlayClipAtPoint(hitSound, c.point);
}
Initial AI Prompt
"You ask the AI: "Play a sound at the bullet hit location.""
Pilot Comm Link
Mission Objective: A skilled Pilot directs the AI to use a Pool. You command: "Request an inactive AudioSource from the AudioManager pool, move it to the location, play, and return it."
Optimized Protocol
// Corrected: Recycled Resources AudioSource s = AudioPool.Get(); s.transform.position = c.point; s.PlayOneShot(hitSound);