Skip to content

Commit

Permalink
Run non-UI systems in FixedUpdate schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshiew committed Jan 2, 2025
1 parent 625db35 commit df12c1b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/plugins/src/assets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Plugin for AssetsPlugin {
#[cfg(not(target_family = "wasm"))]
app.add_systems(OnEnter(AppState::LoadingAssets), load_assets)
.add_systems(
Update,
FixedUpdate,
(check_assets.run_if(in_state(AppState::LoadingAssets)),),
);

Expand Down
2 changes: 1 addition & 1 deletion crates/plugins/src/mesh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Plugin for MeshPlugin {
.add_event::<MeshChunkRequest>()
.add_event::<MeshChunkRerequest>()
.add_systems(
Update,
FixedUpdate,
(
events::handle_mesh_chunk_requests.run_if(on_event::<MeshChunkRequest>),
events::handle_mesh_chunk_rerequests.run_if(on_event::<MeshChunkRerequest>),
Expand Down
18 changes: 11 additions & 7 deletions crates/plugins/src/scene/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,8 @@ impl Plugin for ScenePlugin {
.add_event::<UnloadChunkOpEvent>()
.add_event::<UpdateSceneEvent>()
.add_systems(
Update,
FixedUpdate,
((
(
handle_update_scene_view.run_if(on_event::<UpdateSettingsEvent>),
check_if_should_update_scene,
update_scene.run_if(on_event::<UpdateSceneEvent>),
)
.chain(),
(
handle::process_load_requested,
handle::process_mesh_requested,
Expand All @@ -332,6 +326,16 @@ impl Plugin for ScenePlugin {
handle::process_unload_chunk_ops.run_if(on_event::<UnloadChunkOpEvent>),
)
.run_if(in_state(AppState::MainGame)),),
)
.add_systems(
Update,
((
handle_update_scene_view.run_if(on_event::<UpdateSettingsEvent>),
check_if_should_update_scene,
update_scene.run_if(on_event::<UpdateSceneEvent>),
)
.chain())
.run_if(in_state(AppState::MainGame)),
);
}
}
2 changes: 1 addition & 1 deletion crates/plugins/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl Plugin for WorldPlugin {
.add_event::<GenerateChunkRequest>()
.add_systems(OnEnter(AppState::InitializingWorld), setup)
.add_systems(
Update,
FixedUpdate,
(
events::handle_generate_chunk_request.run_if(on_event::<GenerateChunkRequest>),
events::handle_generate_chunk_task
Expand Down

0 comments on commit df12c1b

Please sign in to comment.