Tier 3 Series 202

202G: The Tuning Exam

Capstone Exam
Pilot Record
Student Profile
"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);
    }
}

Supervisor's Certification

Authenticated Pilot
pilot_3639030ca543b681
Session Secure

Failure Point #1

Reference Caching Failure

The AI is searching for the Muzzle Transform every single frame. Command it to cache this in Awake.

Failure Point #2

Instantiation Throttling

The AI is creating new bullets rapidly. Command it to implement an Object Pool pattern.

Failure Point #3

Allocation Auditing

The AI is using LINQ and string concatenation in Update. Command it to use a standard loop and cached strings.