Rename vague assets / asset_dependencies tables (and their views) to reflect AssetBundle/PreloadData origin · Issue #82 · Unity-Technologies/UnityDataTools · GitHub
Skip to content

Rename vague assets / asset_dependencies tables (and their views) to reflect AssetBundle/PreloadData origin #82

Description

@SkowronskiAndrew

Summary

The assets and asset_dependencies tables (and their views asset_view / asset_dependencies_view) have vague names that don't convey what they contain or when they are populated. They are easily confused with:

More importantly, the names give no hint that this data is AssetBundle/PreloadData-specific and mostly empty for Player and ContentDirectory builds. From recent investigation:

  • assets is populated only from the AssetBundle Unity object's m_Container (empty for Player/ContentDirectory builds).
  • asset_dependencies is populated from three sources: the AssetBundle object's m_PreloadTable, the synthetic Scene object's contents, and the PreloadData object's m_Assets (the last of which also appears in Player builds).

Proposed names (to discuss)

Current Proposed Notes
assets assetbundle_assets Makes the AssetBundle-object origin explicit.
asset_view assetbundle_asset_view Follow whatever the table becomes.
asset_dependencies preload_dependencies or assetbundle_asset_dependencies See caveat below.
asset_dependencies_view match the table

Caveat on asset_dependencies: the request was to tie its name more clearly to the PreloadData object that populates it. That fits its largest source, but note the table also receives AssetBundle m_PreloadTable rows and scene-content rows, so a strictly preload_-only name is slightly narrower than the current behavior. Worth deciding the intended scope as part of the rename (and it interacts with #81, which may change how/whether the Player-build and scene rows are written).

Relationship to other issues

This is a breaking schema change: bump PRAGMA user_version in Init.sql and update the find-refs schema-version check accordingly.

Places that reference these names in the source

Schema / writers:

  • Analyzer/Resources/AssetBundle.sql - CREATE TABLE assets, CREATE TABLE asset_dependencies, CREATE VIEW asset_view, CREATE VIEW asset_dependencies_view.
  • Analyzer/Resources/Init.sql - view_material_shader_refs and view_material_texture_refs both LEFT JOIN assets a; also the PRAGMA user_version bump.
  • Analyzer/SQLite/Handlers/AssetBundleHandler.cs - INSERT INTO assets, INSERT INTO asset_dependencies, and the index names asset_dependencies_object / asset_dependencies_dependency.
  • Analyzer/SQLite/Handlers/PreloadDataHandler.cs - INSERT INTO asset_dependencies.
  • Analyzer/SQLite/Commands/SerializedFile/AddAssetDependency.cs - TableName => "asset_dependencies", the table-definition comment, and consider renaming the class itself.
  • Analyzer/Properties/Resources.Designer.cs - auto-generated from the .sql resources; regenerates on build, no manual edit, but will show the new names.

Consumers:

  • ReferenceFinder/ReferenceFinderTool.cs - FROM assets a (line ~140) and FROM asset_view (line ~193).

Tests:

  • UnityDataTool.Tests/UnityDataToolPlayerDataTests.cs - SELECT COUNT(*) FROM assets.
  • UnityDataTool.Tests/UnityDataToolAssetBundleTests.cs - SELECT COUNT(*) FROM assets.
  • UnityDataTool.Tests/ExpectedDataGenerator.cs - SELECT COUNT(*) FROM assets.

Documentation:

  • Documentation/analyzer.md - the asset_view (AssetBundleProcessor) and asset_dependencies_view (AssetBundleProcessor) sections.
  • Documentation/analyze-examples.md - references to the assets table (around the "source assets" discussion).

(Search the tree for \bassets\b, asset_dependencies, asset_view, asset_dependencies_view before declaring done; the token "assets" is also a substring of unrelated filenames like sharedassets0.assets, so filter those out.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions