Skip to content

Add clone-based asset editing and SerializedFile/UnityFS writeback - #3

Closed
JustSusie wants to merge 1 commit into
AXiX-official:masterfrom
JustSusie:codex/asset-editing-writeback
Closed

JustSusie wants to merge 1 commit into
AXiX-official:masterfrom
JustSusie:codex/asset-editing-writeback

Conversation

@JustSusie

Copy link
Copy Markdown

Assets can be decoded and encoded, but editing them and writing their containing files requires coordinated cloning, identity validation, offset updates, and bundle compression/encryption. This change adds clone-based editing and immutable editor branches for SerializedFile and UnityFS bundles.

Changes

  • Emit typed Clone methods and guarded property setters; regenerate interfaces to support nested assignments while rejecting unavailable members.
  • Add SerializedFileEditor with ordered edits, explicit type identity for additions, PathID allocation, reference validation, and cached materialization.
  • Preserve original bytes for unchanged files and bundles; patch equal-length payloads and update object offsets/sizes for length changes.
  • Add BundleEditor and connect UnityCN encryption to compressed-block output, preserving uncompressed blocks. Correct trailing block-info placement and partial incompressible-block sizes.
  • Add temporary-file replacement and rollback-capable stream output. AssetWriter defaults to the source file's endianness.

Validation

  • dotnet build UnityAsset.NET.sln -v:m --no-incremental: 0 warnings, 0 errors.
  • dotnet test tests/UnityAsset.NET.Tests/UnityAsset.NET.Tests.csproj -f net10.0 --no-restore -v:q: 577 passed locally (565 existing tests plus 12 new local acceptance cases).
  • Local acceptance coverage includes full-catalogue compilation, real MonoBehaviour byte round trips, nested edits, unchanged bytes, equal-length diff boundaries, length-changing readback, independent branches, added identities, reference rejection, partial-write rollback, and encrypted/unencrypted bundle layouts.

Review notes

400 of the 418 changed files are generated interface artifacts; the generator was first run into a temporary directory. The additional acceptance tests, documentation, and external fixtures are intentionally not included in this PR, pending separate review, so the 577-test count describes the local verification workspace rather than this branch alone.

Materialization currently buffers results in memory. Existing unsupported encoders remain unsupported. Stream rollback requires a seekable destination (and read access when overwriting); use the path overload for atomic file replacement.

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.

2 participants