Note, I'm on bevy 17, so librairies for assets are still mostly on bevy 16
I've never experimented with asset management, so I'm struggling.
The examples are great but to me it's a bazaar of useful things, What am I even supposed to start with.
This one has the most comments and seems to be the one I should be focusing first but what do I know?
https://github.com/bevyengine/bevy/blob/latest/examples/asset/asset_loading.rs
My first question is should I handle loading - unloading like expensive sprites manually to not clog the memories, or the engines does that lifting for me?
My second question is what is the most data driven way to register all assets, below is a prototype I have done
pub enum SoundEffects {
ImpactCinematicBoom
}
impl SoundEffects{
fn value(&self) -> &'static str{
match *self {
SoundEffects::ImpactCinematicBoom => "impact-cinematic-boom",
}
}
}
// Then I'll handle the loading down the line in a system
I could then add more methods for more, but would there be a pitfall with that approach?
Third question is how can I get the handle of anything I loaded with the minimum amount of code (in logic)?
Is that when loaded, I can reclaim the handle whenever I want by querying it from the ECS?
Or do I need to make a "registry struct" of handles and then query that handle?
Fourth question is a bit less about that and more about how can I, with the least amount of code (in logic), call a system that handles assets?
For example:
I have a logical situation where I have to play a ring sound sfx.
I ideally just want to limit the code of that by just calling one function, well actually I want to order the ECS runtime to call a system that will generate (or not) the sound effect.
What tool with bevy should be used for that? State? Events?
Thanks for reading