AI Command Lab // Flight Simulator
306D: The Instanced Fleet
Initial AI Output (Fragile)
// AI-Generated Code: Batch Breaker
void Start() {
// Audit Fail: Accessing .material creates a NEW material in memory.
// You now have 1,000 materials and 1,000 draw calls.
renderer.material.color = Random.ColorHSV();
}
Initial AI Prompt
"You ask the AI: "Give every asteroid a random color.""
Pilot Comm Link
Mission Objective: A skilled Navigator directs the AI to use Instanced Properties.
Optimized Protocol
// Corrected: 1 Draw Call
MaterialPropertyBlock block = new MaterialPropertyBlock();
block.SetColor("_Color", Random.ColorHSV());
renderer.SetPropertyBlock(block);