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

AssetServer returns LoadState::NotLoaded when trying to load an asset with an invalid extension. #2261

Closed
NathanSWard opened this issue May 27, 2021 · 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

@NathanSWard
Copy link
Contributor

Bevy version

main

What you did

Using the asset server, try to load a file with an extension that does not match a loader.
Then, use asset_server.get_load_state and it returns LoadState::NotLoaded instead of LoadState::Failed

What you expected to happen

I would expect this to return LoadState::Failed

What actually happened

it returns LoadState::NotLoaded

Additional information

If we plan to address this bug, this requires inserting a SourceInfo struct for each asset that attempts to get loaded.
The reason the behavior exists as is, is because AssetServer::load_async immediately returns if there is no associated loaded for an asset's extension.

@NathanSWard NathanSWard added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled A-Assets Load files from disk to use for things like images, models, and sounds and removed S-Needs-Triage This issue needs to be labelled labels May 27, 2021
@NathanSWard NathanSWard changed the title AssetServer returns LoadState::NotLoaded when trying to load an assets with an invalid extension. AssetServer returns LoadState::NotLoaded when trying to load an asset with an invalid extension. May 27, 2021
@bors bors bot closed this as completed in e549f14 Jun 8, 2021
ostwilkens pushed a commit to ostwilkens/bevy that referenced this issue Jul 27, 2021
…ngine#2318)

# Objective

- Currently, when calling any of the `AssetServer`'s `load` functions, if the extension does not exist for the given path, the returned handle's load state is always `LoadState::NotLoaded`. 
- This is due to the `load_async` function early returning without properly creating a `SourceInfo` for the requested asset.
- Fixes bevyengine#2261

## Solution
- Add the `SourceInfo` prior to checking for valid extension loaders. And set the `LoadState` to `Failed` if the according loader does not exist.
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

Successfully merging a pull request may close this issue.

1 participant