A powerful Unity editor tool for analyzing and visualizing Unity project structure. Uses Roslyn for semantic analysis to automatically scan scenes, scripts, Prefabs, and call relationships, generating visual project dependency graphs.
- Scene Structure Analysis: Automatically scans GameObject hierarchy and components in scenes
- Code Semantic Analysis: Uses Roslyn for C# code semantic parsing, identifying classes, methods, fields, properties
- Prefab Structure: Scans and analyzes Prefab component structures
- Call Relationship Tracking: Identifies method calls, event subscriptions, Inspector references, etc.
- Structural Relationships: Inheritance, implementation, and usage relationships
- Interactive GUI: GraphView-based visual editor window
- Multi-layer Views: Clear display of scene layer, class layer, and library layer
- Smart Search: Real-time node filtering
- Edge Labeling: Call relationships and method name labels
- Color-Coded Nodes: Different node types use different colors for easy identification
- YAML Format Export: Generates structured project structure files
- Structured Data: Includes complete scene, class, call, and relationship data
Download this package, place this package under the Assets directory.
Or Download the version in release packed as .unitypackage
Open the menu in Unity Editor:
Project Scanner > Scan project
Click the "Scan Project" button and wait for the scan to complete.
The scan will generate a ProjectStructure.yaml file in the project root directory.
Open the graph view:
Project Scanner > Project Graph (From YAML)
Click the "Select YAML File" button and select the generated ProjectStructure.yaml file.
In the graph view:
- Use the search box to filter nodes
- Hold
Altor middle mouse button to drag and move the view - Scroll wheel to zoom
- Scene: Blue - Represents Unity scenes
- GameObject: Green - Represents game objects
- Component: Orange - Represents components attached to GameObjects
- Interface: Magenta - Represents C# interfaces
- Enum: Purple - Represents enumeration types
- Struct: Pink - Represents struct types
- Class: Gray - Represents C# classes
- Library: Yellow - Represents external library references
- Constant: Light Blue - Represents constant values
The color of connecting edges represents different relationship types:
- Structural (contains / child_of): Green - Parent-child object relationships
- Component (has_component): Orange - Connections between GameObjects and components
- Property (has_property): Light Blue - Property references
- Inheritance (inherits / implements): Magenta - Inheritance and implementation relationships
- Method Call (uses / method): Light Purple-Blue - Method call relationships
- Reference (references / field_reference): Yellow - Field references
- Other: Gray - Other relationships
Scans scenes for:
- Scene root nodes
- GameObject hierarchy (child_of relationships)
- Component attachments (has_component relationships)
- MonoBehaviour instances
Identifies all C# classes:
- Namespace and class names
- Complete method signatures
- Parameter types and return types
- Fields and properties
- Outside library
Tracks method calls:
- Support Inspector reference relationships
Analyzes code structural relationships contain Inheritance, Usage, Implements
The prefab instantiate inside code treat as external usage, other are ignored or treated as gameobject.
- Roslyn: Microsoft.CodeAnalysis for C# code semantic analysis
- YamlDotNet: YAML serialization
- Unity GraphView: Graph visualization
The generated ProjectStructure.yaml contains the following data:
scenes:
- sceneName: "SampleScene"
gameObjects: [...]
externalClasses:
- namespaceName: "MyNamespace"
className: "MyClass"
methods: [...]
calls:
- fromNodeId: "node_1"
toNodeId: "node_2"
callType: "method_call"
libraryName: "MyLibrary"
methodName: "DoSomething"
structureRelations:
- fromNodeId: "node_1"
toNodeId: "node_2"
relationType: "inherits_from"
prefabs:
- prefabPath: "Assets/Prefab/MyPrefab.prefab"
rootObject: {...}The scanner automatically filters the following content:
UnityEngine.Debug
UnityEngine.Transform
UnityEngine.Time
UnityEngine.Input
...These methods are specially processed to identify their structural significance.
- Editor Only: This package is only for Unity Editor and does not affect runtime performance
- Scan Scope: Only scans files under the
Assetsdirectory, excludesPackagesandEditordirectories - Performance: Large projects may take some time to scan and build graph
This project is fully open source.
Due to the complexity of Unity's system, there may be some methods and calls in Unity that are not fully covered or may be detected incorrectly. We welcome suggestions and feedback to help improve this tool.
Currently, this package cannot be used as a UPM package due to unknown reasons. We hope to resolve this issue in the future.