Subassets of subassets do not work. #15417
Labels
A-Assets
Load files from disk to use for things like images, models, and sounds
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
D-Modest
A "normal" level of difficulty; suitable for simple features or challenging fixes
M-Needs-Migration-Guide
A breaking change to Bevy's public API that needs to be noted in a migration guide
S-Needs-Design
This issue requires design work to think about how it would best be accomplished
X-Controversial
There is active debate or serious implications around merging this PR
Problem
Today,
ErasedLoadedAsset
holds the asset asBox<dyn AssetContainer>
, and holds subassets asHashMap<String, ErasedLoadedAsset>
(not really, but for simplicity, this is true). This means that subassets can themselves hold subassets, and so on, and so on. This makes it very confusing when you find out that these "nested subassets" get "flattened" when they get inserted by theAssetServer
. For example, consider the following loader:The
ErasedLoadedAsset
for this looks like:The resulting Assets would be:
What solution would you like?
Remove
labeled_assets
fromErasedLoadedAsset
/LoadedAsset
and propagate it separately. The hashmap of labeled assets should continue to just useErasedLoadedAsset
.Make the
LoadContext::labeled_asset_scope
(and related) merge the current and the new set of subassets.Make
AssetServer::send_loaded_asset
no longer recursive.What alternative(s) have you considered?
Do nothing. Keep the confusing behavior. This is only an issue if, in an asset loader, in a
LoadContext::labeled_asset_scope
(or equivalent), a subasset shares a name with a previously added subasset.Another alternative: Make them actually work! We could create some notation to support nested subassets in
AssetPath
(for example, "my_asset.blah#A#B#C" or maybe "my_asset.blah#A/B/C"). It's not clear that this is something anyone wants or needs, so the complexity seems unwarranted.The text was updated successfully, but these errors were encountered: