Skip to content

Make asset loading no longer use the type of the load. - #25664

Open
andriyDev wants to merge 5 commits into
bevyengine:mainfrom
andriyDev:no-type-in-loader
Open

Make asset loading no longer use the type of the load.#25664
andriyDev wants to merge 5 commits into
bevyengine:mainfrom
andriyDev:no-type-in-loader

Conversation

@andriyDev

Copy link
Copy Markdown
Contributor

Objective

Fix a bunch of weird edge cases of asset loading:

  • Currently when loading an asset, we use the type of the handle to decide which loader to use, and if that is ambiguous, we fall back to using the extension.
    • So for example, if we call asset_server.load<Gltf>("whatever.png"), this will try to use the GltfLoader since we prioritize the asset type not the extension.
  • We're able to load the same asset path multiple times provided that you use different asset types.
    • For example, if you call asset_server.load<Image>("whatever.png") and asset_server.load<Gltf>("whatever.png"), this will actually do two loads, even though one of these loads makes no sense!
  • Untyped loads can't be deduped.
    • Even if we see a load happening for a specific path, we don't know whether that load is the right type, so we have to fully do the load just to then find out that the type of the asset we loaded was wrong.

Solution

  • We no longer pass the type when finding the loader. This significantly simplifies the loader selection.
  • This means that loading a path is now totally unambiguous allowing for future simplificaftions.

I haven't fixed all of the above issues, but this is the first step.

Testing

  • None. This is pretty much a delete.

@andriyDev andriyDev added A-Assets Load files from disk to use for things like images, models, and sounds X-Contentious There are nontrivial implications that should be thought through D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward C-Refinement Improves output quality, without fixing a clear bug or adding new functionality. labels Sep 3, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Assets Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Assets Load files from disk to use for things like images, models, and sounds C-Refinement Improves output quality, without fixing a clear bug or adding new functionality. D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Contentious There are nontrivial implications that should be thought through

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

1 participant