Skip to content

Commit d4e059c

Browse files
Move feathers propagation into PostUpdate (#20446)
# Objective - As discussed in #20433 (comment), these probably belong in `PostUpdate` to ensure that spawned objects in `Update` have the correct values immediately without the need for ordering. - Finishes and closes #20356. ## Solution - Change the schedule from `Update` to `PostUpdate` ## Testing - I'm not sure exactly how to test this effectively: @viridia, can you advise?
1 parent 47eee93 commit d4e059c

File tree

1 file changed

+12
-4
lines changed
  • crates/bevy_feathers/src

1 file changed

+12
-4
lines changed

crates/bevy_feathers/src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
//! Please report issues, submit fixes and propose changes.
1919
//! Thanks for stress-testing; let's build something better together.
2020
21-
use bevy_app::{HierarchyPropagatePlugin, Plugin, PostUpdate, Update};
21+
use bevy_app::{HierarchyPropagatePlugin, Plugin, PostUpdate, PropagateSet};
2222
use bevy_asset::embedded_asset;
23-
use bevy_ecs::query::With;
23+
use bevy_ecs::{query::With, schedule::IntoScheduleConfigs};
2424
use bevy_text::{TextColor, TextFont};
25+
use bevy_ui::UiSystems;
2526
use bevy_ui_render::UiMaterialPlugin;
2627

2728
use crate::{
@@ -63,11 +64,18 @@ impl Plugin for FeathersPlugin {
6364
app.add_plugins((
6465
ControlsPlugin,
6566
CursorIconPlugin,
66-
HierarchyPropagatePlugin::<TextColor, With<ThemedText>>::new(Update),
67-
HierarchyPropagatePlugin::<TextFont, With<ThemedText>>::new(Update),
67+
HierarchyPropagatePlugin::<TextColor, With<ThemedText>>::new(PostUpdate),
68+
HierarchyPropagatePlugin::<TextFont, With<ThemedText>>::new(PostUpdate),
6869
UiMaterialPlugin::<AlphaPatternMaterial>::default(),
6970
));
7071

72+
// This needs to run in UiSystems::Propagate so the fonts are up-to-date for `measure_text_system`
73+
// and `detect_text_needs_rerender` in UiSystems::Content
74+
app.configure_sets(
75+
PostUpdate,
76+
PropagateSet::<TextFont>::default().in_set(UiSystems::Propagate),
77+
);
78+
7179
app.insert_resource(DefaultCursor(EntityCursor::System(
7280
bevy_window::SystemCursorIcon::Default,
7381
)));

0 commit comments

Comments
 (0)