audio/audio.rs
1//! This example illustrates how to load and play an audio file.
2//! For loading additional audio formats, you can enable the corresponding feature for that audio format.
3
4use bevy::prelude::*;
5
6fn main() {
7 App::new()
8 .add_plugins(DefaultPlugins)
9 .add_systems(Startup, setup)
10 .run();
11}
12
13fn setup(asset_server: Res<AssetServer>, mut commands: Commands) {
14 commands.spawn(AudioPlayer::new(
15 asset_server.load("sounds/Windless Slopes.ogg"),
16 ));
17}