You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decode sprites packed in a 6000.6 SpriteAtlas #229
Follow-up of #155 / PR #228. From Unity 6000.6 a SpriteAtlas no longer has m_PackedSprites / m_PackedSpriteNamesToIndex; every m_RenderDataMap entry holds its sprite itself as *spriteInstanceData (name, rect, pivot, border, pixels per unit, vertex data, indices). PR #228 made the core read that layout (SpriteAtlasFields.renderDataMap[i][1].spriteInstanceData). In real 6000.6 bundles the packed sprites are no longer Sprite objects (the 6000.6.4f1 sprite/sprites fixture has 5 Sprites where the 6000.3 build of the same project has 22), so images(), imageInfo, decodeImage and decodeSprite never see them, and a Sprite object pointing at a 6000.6 atlas is refused with UnsupportedError (kind "Unity version").
Tasks
Make each packed sprite of a 6000.6 atlas addressable through the existing image API (smallest public addition consistent with images() / imageInfo / decodeImage / decodeSprite and the Core: TypeScript-style data shapes for asset.data (camelCase, no m_) #184 naming), and list it in images().
Keep R9 refusals for what is still unsupported (index formats or layouts the fixtures do not show), narrowing the 6000.6 refusal only where this handles it.
Goldens for the packed sprites from the oracle (R12): UnityPy 1.25.4 through scripts/make-modern-goldens.py, or, where UnityPy cannot export them, an independent reference already in the repo (the section 12 source-pixel recipe, the 6000.3 goldens of the same source images); record the oracle and its limits. Decide per fixtures/BUILDING.md section 13 whether the 6000.6 fixtures can move into the main golden set.
Docs: support tables and limits (root and texture README), CHANGELOG texture Unreleased, fixtures/BUILDING.md section 13, JSDoc @throws.
Port
No upstream port: AssetStudio (rev c37af7d) has no 6000.6 SpriteAtlas reader, and UnityPy 1.25.4 exports Sprite objects only. Cutting follows AssetStudio.Utility/SpriteHelper.csCutImage as already ported in sprite.ts.
Acceptance
Every packed sprite of the 6000.6.4f1 sprite, variant, sprite-v2 and sprite-v2-rect fixtures is listed by images() and decodes to its oracle golden (or the verdict recorded next to it, plan §6).
With tightMesh, packed tight sprites are masked by their instance-data mesh and match the recorded reference.
The 6000.6 variant atlas's half-scale entries are resized before the cut; how they are checked is recorded.
What stays unsupported throws UnsupportedError with what was found.
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).
Package:
packages/texture(npmunity-asset-reader-texture),sprite.ts/image.tsDescription
Follow-up of #155 / PR #228. From Unity 6000.6 a
SpriteAtlasno longer hasm_PackedSprites/m_PackedSpriteNamesToIndex; everym_RenderDataMapentry holds its sprite itself as*spriteInstanceData(name, rect, pivot, border, pixels per unit, vertex data, indices). PR #228 made the core read that layout (SpriteAtlasFields.renderDataMap[i][1].spriteInstanceData). In real 6000.6 bundles the packed sprites are no longerSpriteobjects (the 6000.6.4f1sprite/spritesfixture has 5 Sprites where the 6000.3 build of the same project has 22), soimages(),imageInfo,decodeImageanddecodeSpritenever see them, and aSpriteobject pointing at a 6000.6 atlas is refused withUnsupportedError(kind"Unity version").Tasks
images()/imageInfo/decodeImage/decodeSpriteand the Core: TypeScript-style data shapes for asset.data (camelCase, no m_) #184 naming), and list it inimages().textureRect/textureRectOffset/settingsRaw(packing flip/rotation undone), with the existing split-alpha merge (Sprites with an alpha texture (ETC1 split alpha) #152) and variant downscale (Sprites of a variant atlas (downscaleMultiplier) #153) paths; withtightMesh, mask it with the instance data's mesh (vertices / indices).scripts/make-modern-goldens.py, or, where UnityPy cannot export them, an independent reference already in the repo (the section 12 source-pixel recipe, the 6000.3 goldens of the same source images); record the oracle and its limits. Decide perfixtures/BUILDING.mdsection 13 whether the 6000.6 fixtures can move into the main golden set.fixtures/BUILDING.mdsection 13, JSDoc@throws.Port
No upstream port: AssetStudio (rev c37af7d) has no 6000.6 SpriteAtlas reader, and UnityPy 1.25.4 exports
Spriteobjects only. Cutting followsAssetStudio.Utility/SpriteHelper.csCutImageas already ported insprite.ts.Acceptance
sprite,variant,sprite-v2andsprite-v2-rectfixtures is listed byimages()and decodes to its oracle golden (or the verdict recorded next to it, plan §6).tightMesh, packed tight sprites are masked by their instance-data mesh and match the recorded reference.UnsupportedErrorwith what was found.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 underpackages/; dependencies point feature package -> core only (plan D7/D8, rules R13/R14).