Tier 3
Series 202
202G: The Tuning Exam
Capstone Exam
"The aircraft is shuddering violently (Lag). The telemetry shows massive memory spikes and the engine is stalling (Frame Drops). Identify the **three critical performance failures** in this loop to stabilize the flight."
Target Asset for Audit
FRAGILE_CODE_DETECTED
using UnityEngine;
using System.Linq;
public class GunSystem : MonoBehaviour {
public GameObject bulletPrefab;
public List<Enemy> enemies;
void Update() {
// Audit Requirement: Lesson 202C (Caching)
// Error 1: Constant component lookup
Transform muzzle = GetComponent<Transform>().Find("Muzzle");
// Audit Requirement: Lesson 202B (Pooling)
// Error 2: Instantiation in Update
if (Input.GetButton("Fire1")) {
Instantiate(bulletPrefab, muzzle.position, muzzle.rotation);
}
// Audit Requirement: Lesson 202A/D (Allocation)
// Error 3: String concat + LINQ in Update
var nearest = enemies.OrderBy(x => x.dist).First();
Debug.Log("Nearest: " + nearest.name);
}
}