Order of assets in groups

Assets inside a group in Addressables have a basic order, that appears to correspond to the order of when the assets were made addressable but is highly unpredictable. E.g. making an asset non-addressable and then addressable again preserves its position in the group. Or when moving assets between groups, they change order in ways I haven’t been able to figure out.

Unfortunately, this order isn’t editable. In the group it seems like you could drag assets to reorder them but nothing happens. But this order is used when opening the groups window without choosing another sorting and, crucially, in the “Select Addressable Asset” picker window, where sorting options aren’t available.

This is really annoying. Either there should be an explicit ordering that can be changed in the groups window or the assets should always be sorted by e.g. addressable name (and the current implicit ordering not used anywhere at all).

Or am I somehow missing something?

(I can edit the group asset YAML file directly to change the order but that’s really the worst possible option.)

Hi @Adrian The entries for the a Group are stored as a Dictionary, which has no defined order. Though its usually the order they are added. And serialized from the dictionary to the yaml in what order the dictionary provides.

We sort the entries before building in order to keep determinism for the build order.

We will look into your feedback when we look for what features to develop.

Thanks,
Andy

Sorting by Addressable name doesn’t seem to work. that would be a good start :smile:

Sorting by name can be done through the TreeView, click on the column name for sort ascending or descending.
Without any sorting, it’ll be about the order they were added to the group (as mentioned Dictionary technically has no defined order, and can work differently under some circumstances)

Hello @andymilsom !

Should it guarantee determinism everywhere ? Asset bundle(s) of the corresponding Asset Group and Addressables catalog, or only one of them ?

That sorting is for the bundles. Though the catalog locations are gathered as a part of the build, and should also therefore be deterministic based on the input sorting

1 Like

Based on what are bundles sorted? I would like to make some bundles to be built at the very end to allow some build data postprocessing

By sorting I mean of the assets in the groups before they are passed into the build pipeline. So the order is deterministic for the build.
There is no way to order the order of the bundles being built. Once we setup the data its a synchronous call to build.

replacing m_EntryMap with:

SortedDictionary<string, AddressableAssetEntry> m_EntryMap = new SortedDictionary<string, AddressableAssetEntry>();

Should completely solve this issue. I have a local fork of addressables just for this reason. This ensures that they are serialized to disk in the same order every time.

2 Likes

I want to bump this thread, as my last comment is something that significantly improves the use of bundles in a large project that has version control.

1 Like

This would be incredible and is a super easy fix, Addressables Team. We’re dealing with serializing auto generated groups based on large numbers of assets, and is literally a constant merge mess. We’re sorting our assets before handing to addressables, only to find out that they’re adding it to a dictionary which kills the ability for us to pre-sort our assets since the sorting is somewhat dependent on whatever Dictionary decides that day.

Basically, it is a constant source of merge conflicts if every time we regenerate our Addressables Groups we get different ordering between the elements. It’s usually consistent, but periodically something changes it enough that things are just weird. Would be really nice to get this added to an upcoming Addressables version.