Sujith:) 2fbef7a443 Sujith :) -> 1 day atrás
..
__pycache__ b8cd09f2ef Sujith :) -> 1 day atrás
parsers 2fbef7a443 Sujith :) -> 1 day atrás
utils b8cd09f2ef Sujith :) -> 1 day atrás
README.md 1aee008eeb Sujith :) -> 6 days atrás
README.md.meta aa6c1eb3e1 Sujith :) -> 6 days atrás
SceneParsing.md fbefeedc6d Sujith :) -> 1 day atrás
SceneParsing.md.meta fbefeedc6d Sujith :) -> 1 day atrás
__pycache__.meta fbefeedc6d Sujith :) -> 1 day atrás
extract_high_level.py 65ddaeeb2e Sujith :) -> 1 day atrás
extract_high_level.py.meta 1aee008eeb Sujith :) -> 6 days atrás
extract_low_level.py 2fbef7a443 Sujith :) -> 1 day atrás
extract_low_level.py.meta aa6c1eb3e1 Sujith :) -> 6 days atrás
extract_mid_level.py 2fbef7a443 Sujith :) -> 1 day atrás
extract_mid_level.py.meta 1aee008eeb Sujith :) -> 6 days atrás
parsers.meta 2fbef7a443 Sujith :) -> 1 day atrás
scene_processor.py b8cd09f2ef Sujith :) -> 1 day atrás
scene_processor.py.meta fbefeedc6d Sujith :) -> 1 day atrás
utils.meta 1aee008eeb Sujith :) -> 6 days atrás

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.