Add lazy loading for labeled assets - #25698
Open
ewmb7701 wants to merge 2 commits into
Open
Conversation
Contributor
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
ewmb7701
force-pushed
the
feature/labeledAssetReader
branch
from
September 5, 2026 21:29
6e184ef to
504f6fd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective
This pull request adds labeled asset readers so that developers can lazily load labeled assets. This is useful for so-called "random access assets", such as archives.
This resolves #25517, #21758, and #21641.
Solution
An asset loader can now register a labeled asset reader to the load context of an asset. The asset server now has various
load_labeledmethods which can load a labeled asset using the registered labeled asset reader and standard asset loader resolution. ie, the labeled asset reader reads the bytes from the root asset, then passes those bytes to the loader.Testing
I wrote three tests, in crates\bevy_asset\src\lib.rs:
load_labeled_uses_existing_loader_and_its_settings,load_labeled_can_load_a_dependency_from_the_same_archive, andload_labeled_can_load_a_dependency_from_the_same_archive. I tested these changes onx86_64-pc-windows-msvc.Remarks
The code was co-authored with GPT-5.6 Sol.
This is the first step for labeled asset readers; there is more work to be done, probably requiring design and planning: