Fix: Make shipwreck sound entity despawn itself
I started to work on weapon fire sounds and realized I don't know if the entity and/or component get removed after playback ends. It turns out that they DO NOT!... unless told to do so, like this.
This commit is contained in:
@@ -237,7 +237,7 @@ pub fn ship_impact_listener(
|
|||||||
// STEP 5: Play crash sound
|
// STEP 5: Play crash sound
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
AudioPlayer::new(game_assets.wreck_sound()),
|
AudioPlayer::new(game_assets.wreck_sound()),
|
||||||
PlaybackSettings::ONCE,
|
PlaybackSettings::DESPAWN, // despawn this entity when playback ends.
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user