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

bevy_asset: Add LoadContext::get_handle_untyped #8470

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

MrGVSV
Copy link
Member

@MrGVSV MrGVSV commented Apr 23, 2023

Objective

Currently, there isn't a clean way of getting an untyped handle to an asset during asset loading. This is useful for when an asset needs to reference other assets, but may not know the concrete type of each asset.

We could "hack" this together by just using some random asset:

// We don't care what `bar.baz` is, so we "pretend" it's an `Image`
let handle: Handle<Image> = load_context.get_handle("foo/bar.baz");

This should work since we don't actually care about the underlying type in this case. However, we can do better.

Solution

Add the LoadContext::get_handle_untyped method to get untyped handles to assets.

@mockersf mockersf added the A-Assets Load files from disk to use for things like images, models, and sounds label Apr 23, 2023
@cart cart added this pull request to the merge queue Apr 25, 2023
Merged via the queue into bevyengine:main with commit 6df65a2 Apr 25, 2023
@MrGVSV MrGVSV deleted the asset-loader-untyped-handle branch April 25, 2023 19:57
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants