Repository navigation
Let callers supply a Unity version for version-stripped files #105
Description
Package: packages/core (npm unity-asset-reader)
Description
Since #99 (PR #107), a version-stripped SerializedFile keeps version [0, 0, 0, 0] when the bundle it belongs to does not record a revision. That covers every editor-built stripped bundle: 2019.4.41f2, 2020.3.30f1 and 6000.3.25f1 all write "0.0.0" in the bundle header too. The objects stay readable through their typetrees. But version-gated class readers refuse [0, 0, 0, 0] with UnsupportedError (the rule recorded on #28 and #36), so a caller cannot use them on such a bundle, even when they know which editor built it. This is a convenience, not a blocker.
Both upstreams let the caller supply the version:
- AssetStudio
AssetsManager:SpecifyUnityVersion(overrides every file) andDefaultVersion(used only for a stripped file with nothing detected), both read inCheckStrippedVersion. - UnityPy:
config.FALLBACK_UNITY_VERSION, used bySerializedFile.set_versionandBundleFile.parse_versionwhen there is no usable version.
Raised while implementing #99.
Tasks
- Design the option (for example a
unityVersionfallback onload()) and decide whether it only fills a stripped version (DefaultVersion/ UnityPy) or also overrides recorded ones (SpecifyUnityVersion). Record the choice in the PR. - Apply it in
env.tsafter the enclosing-bundle fallback from Fall back to a bundle revision for version-stripped SerializedFiles #99, reusingsetUnityVersion. - Test with a hand-built version-stripped file, both loose and in a bundle with a stripped revision.
Port
AssetStudio/AssetsManager.cs (CheckStrippedVersion, SpecifyUnityVersion, DefaultVersion).
Acceptance
- A version-stripped SerializedFile with no usable bundle revision reports the caller-supplied version when one is given, and keeps
[0, 0, 0, 0]when none is. - Files that record their version are unaffected.
Plan: docs/unity-asset-reader-plan.md. Behavior source of truth: Razviar/assetstudio (MIT). Golden oracle: UnityPy (MIT). MIT-derivative port: keep upstream copyright notices. Do not copy or import @arkntools/unity-js (AGPL-3.0), tests included. No C# compiled to WASM - C# is reference only, hand-ported to TS; WASM is built from C/C++ only (plan D2). Layout: npm-workspaces monorepo under packages/; dependencies point feature package -> core only (plan D7/D8, rules R13/R14).
Activity