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.)
Summary
The
assetsandasset_dependenciestables (and their viewsasset_view/asset_dependencies_view) have vague names that don't convey what they contain or when they are populated. They are easily confused with:asset_bundlestable (a different thing - the Unity Archive; see Generalize use of AssetBundle to Archive in analyze schema and elsewhere #68 for its rename),serialized_files,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:
assetsis populated only from the AssetBundle Unity object'sm_Container(empty for Player/ContentDirectory builds).asset_dependenciesis populated from three sources: the AssetBundle object'sm_PreloadTable, the synthetic Scene object's contents, and thePreloadDataobject'sm_Assets(the last of which also appears in Player builds).Proposed names (to discuss)
assetsassetbundle_assetsasset_viewassetbundle_asset_viewasset_dependenciespreload_dependenciesorassetbundle_asset_dependenciesasset_dependencies_viewCaveat on
asset_dependencies: the request was to tie its name more clearly to thePreloadDataobject that populates it. That fits its largest source, but note the table also receives AssetBundlem_PreloadTablerows and scene-content rows, so a strictlypreload_-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
asset_bundles. These renames should share a naming convention and probably land together.asset_dependencies(e.g. removing theobject = -1rows, fixing scene handling), it may be cleaner to fix analyze: scene/preload dependencies broken outside BuildPipeline.BuildAssetBundles (dangling assets rows; object -1 rows) #81 first or do both together to avoid churning the schema twice.This is a breaking schema change: bump
PRAGMA user_versioninInit.sqland 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_refsandview_material_texture_refsbothLEFT JOIN assets a; also thePRAGMA user_versionbump.Analyzer/SQLite/Handlers/AssetBundleHandler.cs-INSERT INTO assets,INSERT INTO asset_dependencies, and the index namesasset_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.sqlresources; regenerates on build, no manual edit, but will show the new names.Consumers:
ReferenceFinder/ReferenceFinderTool.cs-FROM assets a(line ~140) andFROM 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- theasset_view (AssetBundleProcessor)andasset_dependencies_view (AssetBundleProcessor)sections.Documentation/analyze-examples.md- references to theassetstable (around the "source assets" discussion).(Search the tree for
\bassets\b,asset_dependencies,asset_view,asset_dependencies_viewbefore declaring done; the token "assets" is also a substring of unrelated filenames likesharedassets0.assets, so filter those out.)