|
|
2 months ago | |
|---|---|---|
| .. | ||
| Documentation | 2 months ago | |
| __pycache__ | 2 months ago | |
| config | 2 months ago | |
| orchestrators | 2 months ago | |
| parsers | 2 months ago | |
| utils | 2 months ago | |
| Documentation.meta | 2 months ago | |
| README.md | 3 months ago | |
| README.md.meta | 3 months ago | |
| __pycache__.meta | 2 months ago | |
| config.meta | 2 months ago | |
| orchestrators.meta | 2 months ago | |
| parsers.meta | 2 months ago | |
| utils.meta | 3 months ago | |
This directory contains a suite of Python scripts designed to extract and process data from a Unity project in various levels of detail.
There are three main executable scripts:
extract_high_level.py: Generates a top-down summary of the project, including project settings, package manifests, and GUID-to-asset path mappings.extract_mid_level.py: Creates a virtual representation of the project's Assets directory. It converts scenes and prefabs into JSON files representing the GameObject hierarchy and copies all C# scripts.extract_low_level.py: Performs a deep-dive extraction, creating a detailed JSON file for every single GameObject in each scene and prefab.All scripts are designed to be run from the root directory of the Unity project. They require a Python virtual environment with ruamel.yaml installed.
Activate the virtual environment:
source venv/bin/activate
Each script accepts two command-line arguments:
--input: The root directory of the Unity project (e.g., .).--output: The directory where the generated output folder will be saved.Example:
To run the high-level extractor and save the output to a folder named MyOutput:
python3 Assets/LLM/source/extract_high_level.py --input . --output ./MyOutput
To run the mid-level extractor:
python3 Assets/LLM/source/extract_mid_level.py --input . --output ./MyOutput
To run the low-level extractor:
python3 Assets/LLM/source/extract_low_level.py --input . --output ./MyOutput
The core logic is contained in the utils/ subdirectory:
yaml_utils.py: Handles the complexities of parsing Unity's custom YAML format.file_utils.py: Provides helper functions for file system operations like finding files.virtual_tree_builder.py: Builds the nested GameObject hierarchy for the mid-level extractor.deep_parser.py: Contains the logic for the deep, flat-list parsing used by the low-level extractor.json_reducer.py: An unused utility for reducing the size of JSON objects.