Visual Audit Protocol

The Communication Array

Return to Hangar
6A

The Direct Link

The Concept: Tight Coupling

Hardwired
Decoupled
// Corrected: Safe wiring. if (uiManager != null) { uiManager.UpdateHealth(hp); }
6B

The Message Broadcast

The Concept: The Observer Pattern

Broadcasting
"// Corrected: The Player just "Broadcasts" [SerializeField] private UnityEvent onDeath; void Die() { onDeath.Invoke(); }"
6C

The Delegate Dispatch

The Concept: C# Actions

Broadcasting
"// Corrected: High-speed fiber optics public static Action<int> OnScoreChange; void AddScore(int amt) { score += amt; // The "?" checks if anyone is listening before sending OnScoreChange?.Invoke(score); }"
6D

Static Interruption

The Concept: Event Life-Cycle

Memory Leak
// AI-Generated Code: The Silent Killer void OnEnable() { GameManager.OnPause += ShowPauseMenu; } // Audit Fail: Where is OnDisable? // When this object is destroyed, the GameManager // still tries to talk to it, causing a MissingReferenceException.
Clean Up
void OnDisable() { // Corrected: Hanging up the phone. GameManager.OnPause -= ShowPauseMenu; }
6E

Singleton Sanitation

The Concept: The Singleton Pattern

Memory Leak
// AI-Generated Code: Dangerous Duplication void Awake() { DontDestroyOnLoad(this); // Audit Fail: If you return to the Main Menu and // load the game again, a second GameManager is created. }
Clean Up
public static GameManager Instance; void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); // Throw the imposter overboard } }
6F

The Interface Bridge

The Concept: Polymorphism

Hardwired
Decoupled
// Corrected: Universal Socket IDamageable target = other.GetComponent<IDamageable>(); if (target != null) { target.TakeDamage(10); }
CAPSTONE EXAM

The Communication Exam

The AI has generated a "Communication Hub" that is creating spaghetti dependencies and memory leaks. Identify the three critical failures to restore signal integrity.

Verify Capacity
Check Scope
Audit Efficiency