Bevy Web Asset
This is a tiny crate that that wraps the standard bevy asset loader, and adds the ability to load assets from http and https urls.
Supports both wasm (web-sys) and native.
If asset paths start with http:// or https://, then we try to do a web request to load the asset, otherwise, we just call the normal asset io.
This is nice if you want to keep your content on a server, even when developing native games. Use cases can be:
- Tuning game balance post-launch
- Seasonal events (halloween theme etc.)
- Downloading dynamic content from 3rd party services (lospec, gltf repositories etc.)
- Sharing user-created assets/mods over some service (level editor etc.)
- Keeping initial download size small
- Testing with different online assets during development
Usage
NOTE: You need to add the plugin before DefaultPlugins:
new
// The web asset plugin must be inserted before the `AssetPlugin` so
// that the asset plugin doesn't create another instance of an asset
// server. In general, the AssetPlugin should still run so that other
// aspects of the asset system are initialized correctly.
.add_plugin
.add_plugins
.add_startup_system
.run;
});
But using it is quite simple, just use http urls instead of regular asset paths.
let font: = asset_server.load;
Or:
commands.spawn_bundle;
Bevy version support
I intend to support the latest bevy release in the main branch.
Fixes against the Bevy main branch goes in the the bevy-main branch and are
merged back into main whenever bevy is released.
| bevy | bevy_web_asset |
|---|---|
| main | bevy-main |
| 0.8 | 0.4, main |
| 0.7 | 0.3 |
| 0.6 | 0.2 |
| 0.5 | 0.1 |