-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Asset loading on the Web produces many 404 errors for .meta
files
#10157
Comments
A solution might be for the web asset source to write out a manifest file of the available asset files. This could also be used to solve |
Adding the 0.12 milestone. I think this should be looked over before the release, it will raise a lot of questions on wasm |
Should probably just suppress the error message on wasm for now, until we come up with something better. |
No PR exists, and the release is imminent. Bumping to 0.13, but I'd nominate this for 0.12.1 as well. |
Adding this info for searchability. This is also tripping up users who are using They will see error messages like
Because the web server is just serving the contents of |
When uploaded to itch.io, the server the assets are hosted on return 403 instead of 404, and this actually causes the game to completely fail to run. |
If we can get a fix in for this, we should include it in 0.12.1 |
Is there a procedure users can follow right now to generate default meta files to work around the issue on itch? edit: Here is something that seems to work:
edit: unconfirmed, but I had some feedback on Discord that Itch still serves http |
Since it wasn't said, .set(AssetPlugin {
mode: AssetMode::Unprocessed,
..default()
}) does not fix the issue. |
Yeah this needs fixing for 0.12.1, especially given that the next Bevy Jam is coming up / WASM builds are a big part of that. I think long term the path forward is "asset packing/compression with manifests". That way we can record if a meta file exists in the manifest and avoid making the request. And WASM deployments should probably ultimately be using processing + packing anyway to cut down on bandwidth usage / loading times. Short term, I think we should probably just add a knob that controls meta file lookup behavior. Ex: enum AssetMetaMode {
// Always look for meta files
Always,
// Only look up meta files for assets in the given list
AllowList(Vec<AssetPath<'static>),
// Never look for meta files. The default loader meta values will be used
Never,
} Given that most people probably aren't using meta files at this point, this is probably the right "patch fix" approach. Users can just set this to |
# Objective Fixes #10157 ## Solution Add `AssetMetaCheck` resource which can configure when/if asset meta files will be read: ```rust app // Never attempts to look up meta files. The default meta configuration will be used for each asset. .insert_resource(AssetMetaCheck::Never) .add_plugins(DefaultPlugins) ``` This serves as a band-aid fix for the issue with wasm's `HttpWasmAssetReader` creating a bunch of requests for non-existent meta, which can slow down asset loading (by waiting for the 404 response) and creates a bunch of noise in the logs. This also provides a band-aid fix for the more serious issue of itch.io deployments returning 403 responses, which results in full failure of asset loads. If users don't want to include meta files for all deployed assets for web builds, and they aren't using meta files at all, they should set this to `AssetMetaCheck::Never`. If users do want to include meta files for specific assets, they can use `AssetMetaCheck::Paths`, which will only look up meta for those paths. Currently, this defaults to `AssetMetaCheck::Always`, which makes this fully non-breaking for the `0.12.1` release. _**However it _is_ worth discussing making this `AssetMetaCheck::Never` by default**_, given that I doubt most people are using meta files without the Asset Processor enabled. This would be a breaking change, but it would make WASM / Itch deployments work by default, which is a pretty big win imo. The downside is that people using meta files _without_ processing would need to manually enable `AssetMetaCheck::Always`, which is also suboptimal. When in `AssetMetaCheck::Processed`, the meta check resource is ignored, as processing requires asset meta files to function. In general, I don't love adding this knob as things should ideally "just work" in all cases. But this is the reality of the current situation. --- ## Changelog - Added `AssetMetaCheck` resource, which can configure when/if asset meta files will be read
# Objective Fixes #10157 ## Solution Add `AssetMetaCheck` resource which can configure when/if asset meta files will be read: ```rust app // Never attempts to look up meta files. The default meta configuration will be used for each asset. .insert_resource(AssetMetaCheck::Never) .add_plugins(DefaultPlugins) ``` This serves as a band-aid fix for the issue with wasm's `HttpWasmAssetReader` creating a bunch of requests for non-existent meta, which can slow down asset loading (by waiting for the 404 response) and creates a bunch of noise in the logs. This also provides a band-aid fix for the more serious issue of itch.io deployments returning 403 responses, which results in full failure of asset loads. If users don't want to include meta files for all deployed assets for web builds, and they aren't using meta files at all, they should set this to `AssetMetaCheck::Never`. If users do want to include meta files for specific assets, they can use `AssetMetaCheck::Paths`, which will only look up meta for those paths. Currently, this defaults to `AssetMetaCheck::Always`, which makes this fully non-breaking for the `0.12.1` release. _**However it _is_ worth discussing making this `AssetMetaCheck::Never` by default**_, given that I doubt most people are using meta files without the Asset Processor enabled. This would be a breaking change, but it would make WASM / Itch deployments work by default, which is a pretty big win imo. The downside is that people using meta files _without_ processing would need to manually enable `AssetMetaCheck::Always`, which is also suboptimal. When in `AssetMetaCheck::Processed`, the meta check resource is ignored, as processing requires asset meta files to function. In general, I don't love adding this knob as things should ideally "just work" in all cases. But this is the reality of the current situation. --- ## Changelog - Added `AssetMetaCheck` resource, which can configure when/if asset meta files will be read
Since nobody posted very specifically what to do here, answer is:
to your app before adding default plugins |
There's some code in the linked PR that adds the workaround. Make sure you add this resource before |
Can confirm that this is still happening in |
Just wanted to follow up and say that this should definitely be kept in/after 0.14.0 - my app almost entirely processes non-bevy game assets that will never have meta files. Including loading/mounting archives which gates all other types of file I/O from happening - which ironically means if that if this feature is enabled, the archives themselves can get gated/hung by the asset waiting for it's associated Definitely something I can workaround by just letting those requests bypass the gate, but if someone else were to do something similar, and the archives themselves contain That said, if this is kept in 14.0.0, I think it would be worthwhile to investigate an approach that lets particular resources/loaders/processors opt-out of meta files, as plugins would likely not want to force users to disable meta files across the board/manually register all exceptions. |
Single Page Applications When serving assets from a typical SPA setup they will not load at all without btw heres the app.world_mut().insert_resource(AssetMetaCheck::Never); |
In bevy app.add_plugins(DefaultPlugins.set(AssetPlugin {
meta_check: AssetMetaCheck::Never,
})); |
Just wanted to follow up and say the move to making this a non-resource makes the story for plugins even more complicated than before. Now I have to offer guidance on disabling meta files before my plugin is loaded, rather than just opt-out if my plugin is loaded, which makes the user story more complex. As mentioned before, it would be nice to make this something a given source opts into/out of, instead of having it be global setting. |
I think defaults are also needed app.add_plugins(DefaultPlugins.set(AssetPlugin {
meta_check: AssetMetaCheck::Never,
..default()
})); |
# Objective We should attempt to document the entirety of bevy_assets. `AssetMode` is missing docs explaining what it is, how it's used and why it exists. ## Solution Add docs, focusing on the context in #10157.
This should be add to all example or |
Bevy version
5733d24
What you did
Ran any example that loads assets under WASM / WebGL with:
What went wrong
Got barraged with 404 error messages in the web inspector with the page trying to load
.meta
files for every asset loaded.Additional information
.meta
files for every asset that we loadThe text was updated successfully, but these errors were encountered: