Sujith:) aa6c1eb3e1 Sujith :) -> il y a 2 jours
..
utils aa6c1eb3e1 Sujith :) -> il y a 2 jours
README.md 1aee008eeb Sujith :) -> il y a 2 jours
README.md.meta aa6c1eb3e1 Sujith :) -> il y a 2 jours
extract_high_level.py 1aee008eeb Sujith :) -> il y a 2 jours
extract_high_level.py.meta 1aee008eeb Sujith :) -> il y a 2 jours
extract_low_level.py 1aee008eeb Sujith :) -> il y a 2 jours
extract_low_level.py.meta aa6c1eb3e1 Sujith :) -> il y a 2 jours
extract_mid_level.py 1aee008eeb Sujith :) -> il y a 2 jours
extract_mid_level.py.meta 1aee008eeb Sujith :) -> il y a 2 jours
utils.meta 1aee008eeb Sujith :) -> il y a 2 jours

README.md

Unity Project Data Extractor

This directory contains a suite of Python scripts designed to extract and process data from a Unity project in various levels of detail.

Core Scripts

There are three main executable scripts:

  1. extract_high_level.py: Generates a top-down summary of the project, including project settings, package manifests, and GUID-to-asset path mappings.
  2. 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.
  3. extract_low_level.py: Performs a deep-dive extraction, creating a detailed JSON file for every single GameObject in each scene and prefab.

How to Run

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.

Prerequisites

Activate the virtual environment:

source venv/bin/activate

Execution

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

Utility Modules

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.