Proposal: don't report MonoScripts as potential duplicates

Ouverte
#160 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
48/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
csharp, unity
Domaine
data

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
C#
Étoiles
841
Forks
75
Merge moyen
1 j 7 h
PR mergées (30 j)
3

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de Unity-Technologies/UnityDataTools

Toutes les issues de Unity-Technologies/UnityDataTools

Issues similaires

Plus d'issues C#

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.