-
Notifications
You must be signed in to change notification settings - Fork 52
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
Folder as asset in web deployment #44
Comments
Yes. Folders do not work on the web. Usually, websites do not offer the possibility to get all content under a certain path. If you want to support web, you will have to load your asset files from full paths. |
It seems related to this issue on bevy itself bevyengine/bevy#2916 |
I see we found the same issue. I will have to figure out a way to get around this because it would be nice to easily add new hexes without having to recompile. |
I guess this could be solved by supporting more ways to load folders in dynamic asset collections? ({
"hexes": Folder (
paths: [
"images/hex_1.png",
"images/hex_2.png",
"images/hex_3.png",
"images/hex_4.png",
"images/hex_5.png"
],
),
}) In you code: #[derive(AssetCollection)]
struct ImageAssets {
#[asset(key = "hexes", folder(typed))]
hexes: Vec<Handle<Image>>,
} Would that help? That should work on the web and not require a recompile when adding new file paths. |
That would be a good tool to have. Then a new hex can be added by adding the asset and updating the index file I was thinking I could use trunk.rs to generate the file list as part of the web build. |
I see you implemented the change. I really appreciate that, and thanks for the hard work 🙂 |
I am having trouble getting a folder loaded when running on the web.
I am using your template for building and deploying my stuff to github pages, but a folder that is loading fine on windows is panicking on the web.
You should see the problem on this deployment: (https://troels51.github.io/hex_map_bevy/)
And it is panicking like this in the log
panicked at 'called `Result::unwrap()` on an `Err` value: AssetFolderNotADirectory("hexes")', src\loading\hex.rs:20:10
The text was updated successfully, but these errors were encountered: