-
-
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
embedded_asset!
is broken on Windows Wasm builds
#14246
Comments
assets/
directory
assets/
directoryembedded_asset!
is broken on Windows Wasm builds
Bevy doesn't seem to use |
This seems like a rustc bug. The argument to let path: &Path = file!().as_ref();
let components = path.components().into_iter().collect::<Vec<_>>();
panic!("path: {} components: {:?}", path.display(), components); This results in: Windows native:
Windows wasm:
And, just to top it off, windows native in a separate project I made to test this:
I don't know why |
@kristoff3r that last point sounds like an explanation for why the workaround I reported works in one project but not the other |
I found the difference between the 2 projects, it happens when a project has both a So as far as I can tell the |
@kristoff3r did you submit a bug report to rustc? If so, could you link it? If not, do you want me to file one for you? |
I also encountered this problem when compiling Android targets on Windows:
The path in Windows is so unique that it does not use the common slash '/'. |
Nooooo wayyy FYI, i cannot load assets at all on windows with main.rs and lib.rs:
|
I can guarantee that the path actually exists |
Oops - no it was not the reason - i was using |
This is another issue, sorry for spamming it in here: |
Bevy version
0.14.0
Relevant system information
rustc --version
:rustc 1.81.0-nightly (6292b2af6 2024-07-02)
What you did
There's a minimal reproduction here: https://github.com/janhohenheim/asset-crash
The relevant code is just this
main.rs
:The setup is:
main.rs
splash.png
What went wrong
Running this with
cargo run
works.Running it on Wasm on Windows instead gives me:
This is the part of the Bevy code that panics: https://github.com/bevyengine/bevy/blob/main/crates/bevy_asset/src/io/embedded/mod.rs#L141
And this is the PR that introduced it: #10383
Note that this is not reproducible on Linux
Additional information
The minimal example has a workaround. Move
crate/src/splash.png
intocrate/assets/splash.png
and embed it withembedded_asset!(app, "../assets/splash.png");
.For reasons unknown to me, doing the same workaround on https://github.com/TheBevyFlock/bevy-template does not work.
I also tried running the embedded assets example with
cargo build --example ...
and that one works.Using
load_internal_binary_asset
like this works as well:The text was updated successfully, but these errors were encountered: