Dependency Visualizer Graph

The Dependency Visualizer provides an interactive node graph window that maps relationships between GameObjects, Components, and script assets. This helps you track asset reference chains and isolate circular dependencies that compromise performance.


Architecture of the Graph Engine

The Visualizer parses references using Unity’s serialization reflection APIs:

  • Crawls GameObjects and reads all attached MonoBehaviour and built-in components.
  • Inspects serialized fields using SerializedObject and SerializedProperty iteration.
  • Finds object references (SerializedPropertyType.ObjectReference) to map edges.
 [ GameObject Node ]
         │
         ├──► [ Component Node: CharacterController ]
         │
         └──► [ Component Node: PlayerMotor ]
                    │
                    └───► (Edge) ──► [ Referenced Target: CameraPrefab ]

Key Features

1. Circular Reference Detection

  • The Issue: Script A references Script B, which in turn references Script A. While compile-safe, this causes architectural tightness and runtime serialization loops.
  • The Visualizer’s Action: Runs a cycle detection algorithm (Depth-First Search) across the scene node graph. Circular dependency edges are drawn in bold amber to alert developers.

2. Broken Reference Alerts

  • The Issue: A component field displays None (Game Object) or Missing Reference Exception at runtime.
  • The Visualizer’s Action: Serialized fields that are assigned null references or broken IDs are colored red, showing a connection warning directly in the graph.

3. Node Navigation

  • Double-clicking any GameObject node focuses the Unity Scene view and selects it in the Hierarchy.
  • Right-clicking nodes opens context menus to inspect components or view script source code directly.

How to Navigate the Graph

  1. Open the Dependency Graph window: Tools ➔ Decnet ➔ AI Scene Organizer ➔ Dependency Graph
  2. Select a GameObject in the Hierarchy to set as the root.
  3. Click Generate Graph.
  4. Navigation controls:
    • Pan: Hold Middle-Mouse-Button (or Left-Click and Drag on the empty workspace) to pan around the canvas.
    • Zoom: Scroll Wheel to zoom in/out.
    • Re-layout: Click the Auto Layout button in the header toolbar to arrange nodes automatically.
    • Filter: Toggle checkboxes in the sidebar to hide/show built-in components (e.g. MeshFilter, Transform) and focus exclusively on custom scripts.

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