bevy
bevy copied to clipboard
Add support for loading sub-assets as if they were separate files.
Objective
The current AssetServer
system does not support loading assets from inside of container assets that have no way of knowing what they might contain such as zip files or Doom-style WAD files. This aims to add support for this style of asset storage.
Fixes #3319
Solution
This implementation adds a way to defer loading internal assets (a.k.a. sub-assets) from a container asset's (a.k.a. super-asset) AssetLoader
. These deferred loads are then loaded using the existing Asset
loading system once the container asset's AssetLoader
returns.
This system required changes to the existing AssetPath
to allow the system to determine both the sub-asset's path for Asset
IDs and to determine the right AssetLoader
and the super-asset path to determine the file on the filesystem backing the sub-asset.
Changelog
Added
- Added sub-asset support to
AssetPath
- Added ability to register sub-assets from an
AssetLoader
The one remaining CI failure is not due to my changes.
In fact it seems to be due to a slow rollout of releases by the smol
team.
Edit: See #6538
More dependency errors from unrelated dependencies.
Given that the asset system is in flux right now / will almost certainly be replaced soon, I think we should put a pause on this until we have more certainty about the direction of the asset system. I'm currently working on an experimental rewrite and I'll try to consider this use case as a part of that. Lets leave this PR open to ensure this scenario is captured somewhere and we can revisit in a few weeks.