Visual Audit Protocol

The Inspector Insight

Return to Hangar
102A

The Component Audit

The Concept: RequireComponent

?
Missing Dependency
// Corrected: robust and self-healing [RequireComponent(typeof(AudioSource))] // Automatically adds the component public class PlayerJump : MonoBehaviour { private AudioSource audioSource; void Awake() { // Safe to assume it exists because of the attribute above audioSource = GetComponent<AudioSource>(); } void Jump() { audioSource.Play(); } }
102B

The Null Check Protocol

The Concept: The Null Coalescing Operator

NullReference
System Crash
SAFE
?
// Corrected: Safe and concise void AttackNearest() { Enemy e = FindNearestEnemy(); // "If e is NOT null, take damage. Otherwise, do nothing." e?.TakeDamage(10); }
102C

Tag & Layer Validation

The Concept: CompareTag vs. Strings

"A"
// AI-Generated Code: Slow and Unsafe void OnCollisionEnter(Collision other) { // Audit Fail 1: Allocates memory for string comparison // Audit Fail 2: If you rename "Player" to "player", this fails silently. if (other.gameObject.tag == "Player") { Die(); } }
Alloc
// Corrected: Fast and Zero-Garbage void OnCollisionEnter(Collision other) { // Unity optimization magic if (other.gameObject.CompareTag("Player")) { Die(); } }
Fast
102D

The Execution Order Audit

The Concept: Awake vs. Start

1
Awake()
Self-Init
2
Start()
Link External
102E

Component Visibility Audit

The Concept: [HideInInspector]

Code Access
public float val;
Inspector
Hidden
public class Ship : MonoBehaviour { public float maxSpeed = 100f; // Safe! Accessible by code, invisible to designer. [HideInInspector] public float currentSpeed; }
102F

The Tooltip Protocol

The Concept: [Tooltip] & [Range]

Thrust 75%
public class Engine : MonoBehaviour { // Corrected: Self-documenting and safe [Tooltip("Engine Temp in Celsius. Overheats at 100.")] [Range(0f, 150f)] // Slider prevents accidental "5000" input public float heatLevel; }
CAPSTONE EXAM

The Inspector Exam

The Flight Computer is throwing errors. The navigation system is null, the thrusters are undocumented, and the dependency wiring is exposed. Identify the three critical failures to certify your status as a Flight Engineer II.

Verify Capacity
Check Scope
Audit Efficiency