From 73c1ab1d42965e84a1748af24de61eb768d98848 Mon Sep 17 00:00:00 2001 From: TimJentzsch Date: Thu, 2 Mar 2023 22:44:12 +0000 Subject: [PATCH] Fix `bevy_ui` compile error without `bevy_text` (#7877) # Objective - Fixes #7874. - The `bevy_text` dependency is optional for `bevy_ui`, but the `accessibility` module depended on it. ## Solution - Guard the `accessibility` module behind the `bevy_text` feature and only add the plugin when it's enabled. --- crates/bevy_ui/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index ea5a1ba932..b668c2b951 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -9,6 +9,7 @@ mod render; mod stack; mod ui_node; +#[cfg(feature = "bevy_text")] mod accessibility; pub mod camera_config; pub mod node_bundles; @@ -103,7 +104,6 @@ impl Plugin for UiPlugin { .register_type::() .register_type::() .register_type::() - .add_plugin(accessibility::AccessibilityPlugin) .configure_set(UiSystem::Focus.in_base_set(CoreSet::PreUpdate)) .configure_set(UiSystem::Flex.in_base_set(CoreSet::PostUpdate)) .configure_set(UiSystem::Stack.in_base_set(CoreSet::PostUpdate)) @@ -124,6 +124,8 @@ impl Plugin for UiPlugin { // they will never observe each other's effects. .ambiguous_with(bevy_text::update_text2d_layout), ); + #[cfg(feature = "bevy_text")] + app.add_plugin(accessibility::AccessibilityPlugin); app.add_system({ let system = widget::update_image_calculated_size_system .in_base_set(CoreSet::PostUpdate)