Add Support for Dynamic Asset Collections #198
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the ability to load and build collections of dynamic assets in bevy_asset_loader, addressing the need outlined in issue #186. The enhancement allows for more flexible asset management, enabling users to define and group dynamic assets in structured collections.
Motivation
Previously, loading multiple dynamic assets required individual handling for each asset, complicating the asset loading process and cluttering the codebase. With this update, users can now group related assets together, simplifying the loading process (specially for applications that handles a huge number of assets dynamically).
Changes
DynamicAsset Trait for Vec: Implemented the DynamicAsset trait for Vec, enabling the loading and building of asset collections.
StandardDynamicAssetArrayCollection: Introduced a new struct to represent collections of dynamic assets, allowing assets to be grouped and registered under a common key.
Usage Example
With these changes, users can now define array of asset collections in RON format:
And the rust code would look like:
Conclusion
This update offers a straightforward method for managing multiple dynamic assets within the bevy_asset_loader. It's particularly beneficial for applications dealing with a large number of assets dynamically, aiming to simplify the process and improve developer experience. By grouping assets into collections, it hopes to make dynamic asset handling more accessible and less cumbersome.