Scene Scanning & Auditing

The Scene Scanner tab provides a local, high-speed audit engine that inspects the current scene hierarchy for common architectural mistakes and performance bottlenecks before you build or commit assets.


How It Works

Unlike the AI Director which makes remote LLM queries, the Scanner runs 100% locally. It uses C# reflection and hierarchy iteration to crawl through GameObjects and components in your active scene, compiling an array of SceneIssue diagnostics.

graph TD
    A[Scanner Triggered] --> B[Crawling Scene Hierarchy]
    B --> C[Executing Rules Engine]
    C --> D[Missing Scripts Check]
    C --> E[Casing / Naming Check]
    C --> F[Duplicate Positions Check]
    C --> G[Tag & Layer Mismatches]
    D & E & F & G --> H[Generate SceneReport]
    H --> I[Render UI List in Dashboard]

Technical Audit Categories

1. Missing Scripts Detection

When C# script files are deleted or renamed without correct meta file reconciliation, Unity leaves behind dead component references in the editor:

  • The Issue: A component labeled Missing (MonoBehaviour).
  • The Scanner’s Solution: Iterates over components on each GameObject using GetComponents<Component>() and flags occurrences where the reference is null. The automated fix calls GameObjectUtility.RemoveMonoBehavioursWithMissingScript(gameObject).

2. Naming Conventions Validation

The scan checks object names against standard regex patterns:

  • The Issue: Cloned suffixes (MyObject (1) (Copy) or Mesh_1_Copy_Copy_Copy), trailing whitespaces, or casings violating your team configuration (e.g. PascalCase for parent folders, camelCase for props).
  • The Scanner’s Solution: The regex parser detects common clone indicators and flags them, offering a clean rename fix (e.g. MyObject).

3. Duplicate Object Identification

  • The Issue: Two or more GameObjects with identical names sharing the exact same spatial coordinate (Transform Position). This often happens from accidental duplicate commands (Ctrl+D) and wastes draw calls.
  • The Scanner’s Solution: Compiles a hash map of spatial grids and names. Overlapping objects are flagged, offering an option to merge or delete the duplicates.

4. Tag & Layer Mismatches

  • The Issue: A parent folder marked as Environment layer, but its children are set to Default layer, breaking lighting probes, static baking, and collision matrix sweeps.
  • The Scanner’s Solution: Recurses through parent-child relationships and checks if layers or static flags match, suggesting parent alignment.

Running a Scan

  1. Open the Dashboard and select the Scanner tab.
  2. Choose your Target Scope:
    • Entire Active Scene
    • Selected Hierarchy Only
  3. Click Scan Scene.
  4. The panel displays flagged issues categorized by severity:
    • Critical (Red): Missing scripts, broken references.
    • Warning (Yellow): Duplicate placements, mismatched layers.
    • Info (Blue): naming casing inconsistencies.
  5. Click Fix on individual rows to resolve specific issues, or click Fix All in the header to clean up the entire list.

This site uses Just the Docs, a documentation theme for Jekyll.