Tier 2 Series 103

103G: The Trigger Exam

Capstone Exam
"The sensor array is misfiring. The zones are creating garbage memory, the lasers are hitting clouds instead of targets, and the logic state is stuck on "Entry". Identify the three critical physics failures to certify your status as a Flight Engineer II."

Target Asset for Audit

FRAGILE_CODE_DETECTED
using UnityEngine;

public class SensorArray : MonoBehaviour {
    
    // Audit Requirement: Lesson 103D (State Machine)
    void OnTriggerEnter(Collider other) {
        // Error: Applying continuous radiation damage in Enter
        other.GetComponent<Health>().TakeDamage(1);
    }

    void Update() {
        // Audit Requirement: Lesson 103F (Memory)
        Collider[] hits = Physics.OverlapSphere(transform.position, 10f);

        // Audit Requirement: Lesson 103C (LayerMask)
        if (Physics.Raycast(transform.position, Vector3.forward, out RaycastHit hit)) {
            if (hit.collider.tag == "Enemy") {
                Debug.Log("Target Locked");
            }
        }
    }
}

Supervisor's Certification

Authenticated Pilot
pilot_0e9d68b3f5ace044
Session Secure

Failure Point #1

Logic State Failure

The AI used OnTriggerEnter for continuous damage. Command it to use OnTriggerStay or a Coroutine.

Failure Point #2

Memory Management

Command the AI to stop creating new arrays every frame. Implement a non-allocating sweep.

Failure Point #3

Bitwise Filtering

Command the AI to use a LayerMask to filter the sweep at the engine level rather than checking names in code.