Load assets in Bevy by adding the AssetPlugin to your app and inserting your files into the Assets directory.
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, load_assets)
.run();
}
fn load_assets(mut commands: Commands, asset_server: Res<AssetServer>) {
let texture_handle = asset_server.load("texture.png");
commands.spawn(SpriteBundle {
texture: texture_handle,
..default()
});
}
Place texture.png in your project's assets folder.