mirror of
https://github.com/bevyengine/bevy.git
synced 2026-05-06 06:06:42 -04:00
665d1454af
Add `audio/play_sound_effect` example # Objective Add an example that demonstrates how to load an audio file and play it multiple times on a specific event (pressing space). ## Solution It is similar to the breakout example, but way shorter and focused. This example loads a sound effect as a resource with the `FromWorld` trait, and on a keyboard event spawns an `AudioPlayer` with `DESPAWN` mode. ## Testing - Built on top of 0.18.1, and moved to master - Tested by building the examples, and pressing the space a few times (no overlapping audio) - Tested also by pressing space as fast as I could do for about 1 minute. Lot of components are spawned, played at the same time, but I've found no issues. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>