I cannot for the life of me understand the differences and usages/applications of States, Sets, and Schedules. (mostly the latter two)
Previously I was using a simple State to manage my system ordering, but I realized that my FixedUpdate time was not being applied to any of my systems, which revealed itself after my computer decided to double its frame processing speed and my game started running at 2x speed lol.
So I set out to create a custom SystemSet which i configured to run in CoreSchedule::FixedUpdate as per @ Alice's recommendation.
However, this broke my asset loading stuff which was using bevy_asset_loader via States. Im not sure what the best way to continue to use this crate to pre-laod all my assets. Can i integrate my game states stuff with my new system set somehow?
The issue seems to be that I have a couple systems that need to run once, like startup systems, but only after my assets have loaded. Previously I used OnEnter(GameState::Main) which worked.
Ive tried something like the following, but without any luck:
.add_systems((
setup_healthbar_ui
.after(ClientPlugin::load_on_start)
.run_if(run_once())
.in_base_set(CoreSet::PreUpdate),
))
.add_systems(
(
update_healthbar,
)
.in_base_set(CoreGameSet::Main),
);
I need setup_healthbar_ui to run once before update_healthbar, with a command flush in between.
This is how my custom set is configured
app.edit_schedule(CoreSchedule::FixedUpdate, |s| {
s.configure_set(CoreGameSet::Main);
})
///////
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
#[system_set(base)]
pub enum CoreGameSet {
Main,
}