Tier 2 Series 102

102E: Component Visibility Audit

Pilot Record
Student Profile
"A cockpit shouldn't show the wiring for the bathroom lights. It clutters the dashboard. In Unity, if you have a variable that needs to be public for code access but shouldn't be touched by the designer, hide it. A skilled Engineer audits for Inspector Hygiene."

The Concept: [HideInInspector]

Sometimes a variable must be public (so other scripts can read it), but you don't want designers to edit it in the Unity Editor because it's calculated automatically.

* **[HideInInspector]:** Keeps the variable public in code, but removes it from the Unity UI.
* **{ get; private set; }:** An even better C# approach—public read, private write.
Red Flag Detected

The AI Trap: "The Cluttered Dashboard"

You ask the AI: "Make a variable for the current speed that other scripts can read."

// AI-Generated Code: Visual Noise
public class Ship : MonoBehaviour {
    public float maxSpeed = 100f; // Designer needs this
    
    // Audit Fail: Designer does NOT need this. 
    // Editing this in the Inspector will break the physics math.
    public float currentSpeed; 
}

This is "UI Pollution." It invites mistakes. A designer sees currentSpeed and types '50', thinking it's the starting speed, but the code overwrites it instantly.

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 Pilot's Correction

Corrective Protocol
public class Ship : MonoBehaviour {
    public float maxSpeed = 100f; 

    // Safe! Accessible by code, invisible to designer.
    [HideInInspector] public float currentSpeed; 
}
Your Pilot Command
> Use Query to find specific elements within the VisualTreeAsset.
Next Mission
The Tooltip Protocol