Proposal: don't report MonoScripts as potential duplicates

Đang mở
#160 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ó
3/5
Thời gian dự kiến
1-2 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
data

Hướng nghiên cứu

Start by reading the implementation of view_potential_duplicates and how it gathers content types; the issue does not name a file or test. Compare its MonoScript results with the checked-in LeadingEdgeBuilds/AssetBundles data, where DirectAudioClipReference appears twice. Done means the view no longer reports expected per-file MonoScript copies as potential duplicates, with the issue's Unity change still undecided.

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

Mô tả

enhancement

Proposal - depends on a Unity change that is not yet decided.

A change currently under review in Unity would stop Content Directory builds from collecting all MonoScripts into one shared content file. Instead, each content file would embed its own copy of every MonoScript it references. At load time Unity repoints the hosts to one shared MonoScript per class, so the embedded copies are expected duplication by design, not wasted content.

I analyzed a local build with that change (plus local fixes for SerializedFile v27 and ContentLayout v4). Most of UnityDataTool handles it fine: monoscript_view and script_object_view link each MonoScript to its host in the same file. The one noisy result is view_potential_duplicates, which lists the per-file copies as duplicated content:

instances  name                        type        total_size  size  in_files
2          LoadableAudioClipReference  MonoScript  216         108   6150b4ed....cf, e71b9429....cf

In a real project with many ScriptableObject or prefab content files, this would add a MonoScript row for almost every script class and hide the real duplicates.

Proposal

If Unity ships embedded MonoScripts, exclude MonoScript from view_potential_duplicates, or move it to a separate view or note.

AssetBundle builds already work this way: each bundle carries the MonoScripts it uses, and the view already lists them. In the checked-in LeadingEdgeBuilds/AssetBundles data, DirectAudioClipReference appears twice. So the filter would also remove existing noise from AssetBundle analysis, even if the Unity change doesn't land.

The cost of the embedding (mostly the MonoScript TypeTree in each file's header, about 1 KB per file uncompressed in my test) would then be better reported through TypeTree overhead reporting (#127) than through the duplicates view.

Leaving this open until the Unity change is decided. If it doesn't land, the AssetBundle case alone may still justify the change.

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.