bevy/examples/asset/http_source.rs
jf908 73999cbdc7
Http source fixes
* Rename and split http_source feature to http and https
* Enable http sources when using processed asset mode
* Fix ureq/rustls feature gate (it was only working by accident because ureq with full features is part of the dev dependencies)
* Disable gzip and json ureq features
* Misc. rewording of a couple docs
* Setup HttpSourcePlugin as part of DefaultPlugins to allow for future configuration (there is currently none)
2025-06-30 01:46:43 +01:00

21 lines
718 B
Rust

//! Example usage of the `https` asset source to load assets from the web.
//!
//! Run with the feature `https`, and optionally `http_source_cache`
//! for a simple caching mechanism that never invalidates.
//!
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2d);
let url = "https://raw.githubusercontent.com/bevyengine/bevy/refs/heads/main/assets/branding/bevy_bird_dark.png";
// Simply use a url where you would normally use an asset folder relative path
commands.spawn(Sprite::from_image(asset_server.load(url)));
}