Open takkuumi opened 2 years ago
For now, there is at least one third party plug-in providing that feature. You can check assets plugins at https://bevyengine.org/assets/#asset-loading
Hi there.
I too assumed that you couldn't build a asset plugin that takes a URL. After all, AssetPath.path()
returns a &Path
, and AssetIo
's various methods all take &Path
s.
It turns out that bevy_web_asset
takes advantage of how std::path::Path
is implemented - in that it can hold pretty much anything a String can. This isn't very intuitive - after all, std::path::Path
is meant for filesystem paths, not as another means of holding a String
!
So if I could offer up a suggestion... Perhaps AssetPath
and AssetIo
could provide/take &str
s rather than &Path
s. While this would mean that an AssetIo
has to do a little extra work to convert the given path by itself (i.e. to a std::path::Path
), it would also make it more intuitive that an AssetIo
can be given any format of path, not just a filesystem-like one.
Thoughts?
A big gotcha is a URL like asset.svg?version=abc
won't work since the ?version=...
at the end counts for the asset extension. Thus, an asset loader with the svg
extension won't load this one.
What solution would you like?