You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs: Addressables local→remote dependency example (#67)
Add SQLite example query and narrative for finding explicit addressables in
locally classified bundles that depend on explicit addressables in remote
bundles, using build layout JSON from analyze.
Update addressables-build-reports schema notes and cross-link to the example.
You can analyze a directory with both asset bundles (*.bundle) and json files (*.json) at the same time.
112
112
113
+
### Cross-group dependencies (local → remote)
114
+
115
+
To find explicit addressable assets whose bundle is classified as **local** (for example by `load_path`) but that depend on explicit addressables in **remote** bundles, see [Example: Local Addressable groups depending on remote groups](analyze-examples.md#example-local-addressable-groups-depending-on-remote-groups) in analyze-examples.md.
116
+
113
117
### Sample Queries
114
118
115
119
Once the data is in the database, you can run queries to analyze your Addressables build:
@@ -118,12 +122,12 @@ Once the data is in the database, you can run queries to analyze your Addressabl
118
122
#### Find all implicit assets for an explicit asset
119
123
```sql
120
124
-- Find implicitly included assets for a given explicit asset id
See [buildreport.md](buildreport.md) for information about using analyze to look at BuildReport files.
70
70
71
+
72
+
71
73
## Example: Using AI tools to help write queries
72
74
73
75
This is not a tutorial on using AI tools. However one useful tip:
@@ -261,3 +263,94 @@ Examples of alternative sources of build information:
261
263
* The Editor log reports a lot of information during a build.
262
264
* Regular AssetBundle builds create [.manifest files](https://docs.unity3d.com/Manual/assetbundles-file-format.html), which contain information about the source assets and types.
263
265
* Addressable builds do not produce BuildReport files, nor .manifest files. But UnityDataTools supports analyzing the [Addressables Build Reports](addressables-build-reports.md) and will populate the `addressables_build_explicit_assets` and `addressables_build_data_from_other_assets` tables.
266
+
267
+
## Example: Local Addressable groups depending on remote groups
268
+
269
+
A common scenario when working with remote content, is to add a new piece of content to a local Addressable group that depends upon content in a remote Addressable group. Often this is fine, but if it's unexpected it can lead to the game stalling while downloading a large quantity of remote content. This example prints out content in local Addressable groups that depend upon content in remote groups.
270
+
271
+
UnityDataTools does **not** store a boolean “local” or “remote” flag. Each bundle row has a **`load_path`** string (table `addressables_build_bundles`). You can classify bundles for a given project by testing that string—for example:
272
+
273
+
***Remote bundle:**`load_path` starts with `https://` or `http://` (typical for remote profiles).
274
+
***Local bundle:** not matched by the above (often paths containing `{UnityEngine.AddressableAssets.Addressables.RuntimePath}` or similar). You may refine this for your naming or add conditions such as non-empty `load_path` if you need to exclude odd rows.
275
+
276
+
In this case, we want to know about both explicitly referenced assets and implicitly referenced assets. Explicitly referenced assets are assets that you have directly linked in another bundle, while implicitly referenced assets are dependencies of your source asset. For example, a prefab in a local group may explicitly reference a material in a remote group.
277
+
278
+
**1. Produce a database from your build reports** (adjust paths; on Windows use backslashes or quoted paths):
**2. Find the `build_id`** for the report you care about (often the latest row):
285
+
286
+
```
287
+
sqlite3 addressables_analysis.db "SELECT id, name, start_time FROM addressables_builds ORDER BY id DESC LIMIT 5;"
288
+
```
289
+
290
+
Use that `id` as `:build_id` in the query below.
291
+
292
+
**3. List explicit assets in a local bundle that reference an explicit asset in a remote bundle**
293
+
294
+
The following uses a `UNION ALL` of the two explicit-explicit edge tables. Bundle `load_path` values are joined only so the `WHERE` clause can classify local vs remote bundles; they are not selected in the result. Column aliases **`local_*`** refer to the asset in the locally classified bundle (the referencing side), and **`remote_*`** to the depended-on asset in the remotely classified bundle. The **`dependency_type`** column uses short labels aligned with typical Addressables UI wording: **`explicit`** for edges from **ExternallyReferencedAssets**, and **`implicit`** for edges from **InternalReferencedExplicitAssets**. In both cases the dependency is still between **explicit addressables** in the build layout; non-addressable “other” assets are modeled separately in `addressables_build_explicit_asset_internal_referenced_other_assets` / `addressables_build_data_from_other_assets`.
295
+
296
+
```sql
297
+
SELECT
298
+
'explicit'AS dependency_type,
299
+
src.addressable_nameAS local_address,
300
+
src.asset_pathAS local_asset_path,
301
+
sg.nameAS local_group_name,
302
+
tgt.addressable_nameAS remote_address,
303
+
tgt.asset_pathAS remote_asset_path,
304
+
tg.nameAS remote_group_name
305
+
FROM addressables_build_explicit_asset_externally_referenced_assets x
0 commit comments