Skip to content

feat: add Unity asset export via optional agentdecompile[unity] extra - #158

Merged
bodencrouch merged 4 commits into
masterfrom
feat/unity-asset-export
Jul 30, 2026
Merged

feat: add Unity asset export via optional agentdecompile[unity] extra#158
bodencrouch merged 4 commits into
masterfrom
feat/unity-asset-export

Conversation

@bodencrouch

Copy link
Copy Markdown
Contributor

Supersedes #154, which GitHub auto-closed when its base branch (docs/ilspycmd-optional-dependency, from #150) was deleted after #150's squash-merge. Same content, retargeted to master.

Summary

New unity-export CLI subcommand and src/agentdecompile_recovery/unity_assets.py, adapted from a bounded-memory UnityPy-based export script proven out on a large real-world Unity title where AssetRipper's whole-graph loading OOM'd on heavy Mesh/BlendShapeData.

  • Exports textures, sprites, audio clips, text assets, and fonts one object at a time (freeing each immediately) -- peak memory stays roughly constant regardless of asset file size on disk, unlike full project-reconstruction tools that load the entire asset graph before writing anything.
  • Deliberately does not attempt meshes/materials/scene-prefab structure -- that needs fuller project-graph tooling this module isn't trying to replace.
  • UnityPy is optional (pip install agentdecompile[unity], or via [all]) and imported lazily -- importing unity_assets never requires it installed; invoking the CLI command without it raises a clear ImportError naming the extra.

Test plan

Copilot and others added 4 commits July 30, 2026 03:45
ilspycmd is ILSpy's .NET global tool (dotnet tool install -g ilspycmd),
not a PyPI package -- it cannot be expressed as a pip dependency, and
adding it to optional-dependencies would break `pip install
agentdecompile[all]` for everyone (confirmed: pip/uv cannot resolve it
under any name). Added an [all] extra bundling the real pip-installable
optional features (currently `semantic`) and documented ilspycmd
installation separately in the README as an external prerequisite.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ros3797gzvmswnJudQ1Znk
New `unity-export` CLI subcommand (agentdecompile-recover unity-export
--install-root <dir> --out-dir <dir>) and src/agentdecompile_recovery/
unity_assets.py, adapted from a bounded-memory UnityPy-based export script
proven out on a large real-world title where AssetRipper's whole-graph
loading OOM'd (heavy Mesh/BlendShapeData).

Exports textures, sprites, audio clips, text assets, and fonts one object
at a time (freeing each immediately), so peak memory stays roughly
constant regardless of asset file size on disk -- unlike full
project-reconstruction tools that load the entire asset graph before
writing anything out. Deliberately does not attempt meshes/materials/
scene-prefab structure; that needs the fuller project-graph tooling this
module is not trying to replace.

UnityPy is optional (`pip install agentdecompile[unity]`, or via the
`[all]` extra) and imported lazily -- importing unity_assets never
requires it to be installed; a clear ImportError names the extra to
install if the CLI command is invoked without it.

Also fixed, discovered while running the test suite on this branch:
- tests/test_rewrite_queue.py's two multiprocessing concurrency tests
  failed under Python 3.14 even on Linux (PicklingError on a locally-
  nested function target) -- Python 3.14 changed the default
  multiprocessing start method away from fork on Linux too (previously
  only macOS defaulted away from fork). Forced multiprocessing.get_context
  ("fork") explicitly, same fix already shipped for the macOS-only case.
- source_parity_synthesize.py: removed an unused `.state.now` import
  (ruff F401), pre-existing and unrelated, blocking the lint CI step.

610 unit tests pass; ruff clean.
# Conflicts:
#	pyproject.toml
#	tests/test_rewrite_queue.py
@bodencrouch
bodencrouch merged commit 58ea603 into master Jul 30, 2026
16 checks passed
@bodencrouch
bodencrouch deleted the feat/unity-asset-export branch July 30, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant