Tier 2 Series 105

105E: The Ignition

Pilot Record
Student Profile
"If Scripts A and B both try to talk to each other in `Start()`, one might not be ready yet (Race Condition). An Engineer initializes self in `Awake()` and talks to others in `Start()`."

The Concept: Execution Order

The lifecycle of a script boot-up.

* **Awake:** "I just woke up." (Set up my own variables).
* **Start:** "Everyone is awake." (Talk to other scripts).
* **Rule:** Cache References in Awake; Game Logic in Start.
Red Flag Detected

The AI Trap: "The Null Reference"

You ask the AI: "Setup the player health and UI."

// AI-Generated Code: Race Condition
// Script A (UI) tries to read Player Health in Start()
// Script B (Player) sets up Health in Start()
// Result: 50% chance of "NullReferenceException".

This is "The Initialization Race." Unity does not guarantee which Start() runs first.

Elite Telemetry

Research shows "Elite" teams achieve 15% faster lead times by keeping AI on a "very tight leash."

  • Small Batches Solving one problem at a time prevents logic drift.
  • Modular Design Localizing the "blast radius" of AI changes.
  • Tight Loops Rapid iteration with constant code review.

The Engineer's Correction

Corrective Protocol
// Corrected: Safe Sequence
void Awake() { health = 100; }
void Start() { ui.UpdateHealth(health); }
Your Pilot Command
> Use a Rigidbody with interpolation enabled for smooth, physics-based character movement.
Next Mission
The Link