analyze: support ContentLayout.json v4 (Unity 7000.0)

Đang mở
#159 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp, unity
Lĩnh vực
backend, data

Hướng nghiên cứu

Start with ContentLayoutParser and Documentation/contentlayout-database.md, then inspect the v2 and v3 reference layouts and automated tests. Accept schema version 4 while preserving versions 2 and 3; derive the built-in flag from StableId source type 5 and check that built-in references resolve. Add a v4 layout fixture and verify the documented StableId representation.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Unity 7000.0 (current trunk) writes ContentLayout.json schema version 4. analyze supports versions 2 and 3, so it rejects the file:

Unsupported ContentLayout.json version 4 (this version of UnityDataTool supports versions 2 and 3).
Failed to process: ContentLayout.json

The content files are still analyzed (once SerializedFile v27 is supported), but without the layout. References between content files can't be resolved, and source-asset information is missing.

Schema change (v3 -> v4)

Unity's description of the change:

StableId content changed from the one-way identity hash to the source tuple string it derived from, "cfid-<guid>-<lfid>-<sourceTypeInt>" - identical to the external-reference pathNames written into built content files, so the two are cross-referenceable by string equality. The built-in entry is an ordinary tuple entry of source type DefaultResources, and ArtifactIndex replaced ContentHash.

In practice the JSON keys are the same as v3. The differences:

  • SerializedFiles[].StableId is now e.g. cfid-78532141fd7679a458405eb16bdb75fd-0-1 instead of a bare hash. It matches the external reference paths in the .cf files exactly, as shown by serialized-file externalrefs.
  • IsBuiltIn is gone. The built-in "unity default resources" entry is now cfid-0000000000000000e000000000000000-0-5, with source type 5 = DefaultResources.

Quick experiment

I accepted version 4 in ContentLayoutParser and deserialized it as the v3 model. With that, analyze imported the layout and resolved the cross-file references, since those are resolved by position in the dependency list rather than by StableId. One gap remained: the built-in entry is no longer flagged as built-in, so scene references to default resources (e.g. m_SpotCookie) ended up in dangling_refs. The filename column in content_layout_serialized_files_view also no longer shows the built-in path.

Work includes

  • Accept version 4 and keep supporting 2 and 3.
  • Derive is_builtin for v4 from the source type in the StableId (5 = DefaultResources), and make sure references to built-in files resolve as they did with v3.
  • Decide how to present stable_id: keep the tuple string, or also split it into guid / lfid / source type columns. Since StableId now equals the external reference path, it could also be used to cross-check the positional resolution.
  • Add a v4 reference layout for automated tests, e.g. from a 7000.0 rebuild of UnityProjects/LeadingEdge.
  • Update Documentation/contentlayout-database.md and any docs describing StableId.
Ngôn ngữ chính
C#
Star
841
Fork
75
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Unity-Technologies/UnityDataTools

Tất cả issue của Unity-Technologies/UnityDataTools

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.