bevy
bevy copied to clipboard
Add remote_asset_loader example
Objective
- Showcase how to use
AssetReaderandAssetWriterto download an asset from a CDN when it doesn't exists local.
Solution
- Add an example (
remote_asset_loader) which showcases how to download an asset from a CDN. - Add
ehttpas a newdev-dependencies.
Additional Context
- This is somewhat related to #11694 since I'm also using
ehttpand the samefeatures. - This example won't work on wasm or Android since I need
AssetWriter. - I'm using a Google Font since its Open Font License and it is compatible with MIT and Apache 2.0 (AFAIK);
- At the end of the example
main, I usestd::fs::remove_fileto "manually" do some cleanup, to avoid adding things toassetfolder whenever someone runs this example.
The generated examples/README.md is out of sync with the example metadata in Cargo.toml or the example readme template. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.