Skip to content

Add lazy loading for labeled assets - #25698

Open
ewmb7701 wants to merge 2 commits into
bevyengine:mainfrom
ewmb7701:feature/labeledAssetReader
Open

Add lazy loading for labeled assets#25698
ewmb7701 wants to merge 2 commits into
bevyengine:mainfrom
ewmb7701:feature/labeledAssetReader

Conversation

@ewmb7701

@ewmb7701 ewmb7701 commented Sep 5, 2026

Copy link
Copy Markdown

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_labeled methods 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, and load_labeled_can_load_a_dependency_from_the_same_archive. I tested these changes on x86_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:

  • reloading
  • preloading
  • refactoring existing loaders with eager/ lazy loading which uses new labeled machinery
  • deprecating existing labeled asset loading
  • lifecycle (adopting labeled handles if root is already loading, etc)

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
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
ewmb7701 force-pushed the feature/labeledAssetReader branch from 6e184ef to 504f6fd Compare September 5, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assets as asset sources for labeled assets

1 participant