Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple load_untyped requests for the same labeled asset can result in duplicate asset loads #10549

Open
cart opened this issue Nov 14, 2023 · 0 comments
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior

Comments

@cart
Copy link
Member

cart commented Nov 14, 2023

Bevy version

0.12.0

What went wrong

As of #10514, load_untyped / load_untyped_async will defer handle creation for labeled assets until after the asset loads, as we cannot know the type ahead of time (unless it is provided manually).

This means that loading a labeled untyped asset multiple times won't always "early out" for duplicate asset loads. If a second duplicate request for a labeled untyped asset is made before the labeled asset handle is allocated in the AssetLoader, a second load of the root asset will occur.

This isn't broken, but it is suboptimal / undesirable behavior. I'm not sure we can fix this without changing how handles work.

Notably, I think moving to "assets as entities" (or an equivalent "universal id with indirection" system) resolves this problem because you no longer need to know the type to allocate an identifier. This would also allow us to "de-async-ify" untyped asset loading, which is one of the pain points people are experiencing with Bevy Asset V2.

@cart cart added C-Bug An unexpected or incorrect behavior A-Assets Load files from disk to use for things like images, models, and sounds labels Nov 14, 2023
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-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

1 participant