diff --git a/crates/bevy_ecs/macros/src/lib.rs b/crates/bevy_ecs/macros/src/lib.rs index 20f7ad4275..7b388f4a14 100644 --- a/crates/bevy_ecs/macros/src/lib.rs +++ b/crates/bevy_ecs/macros/src/lib.rs @@ -159,13 +159,6 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream { ) { #(<#active_field_types as #ecs_path::bundle::Bundle>::get_component_ids(components, &mut *ids);)* } - - fn register_required_components( - components: &mut #ecs_path::component::ComponentsRegistrator, - required_components: &mut #ecs_path::component::RequiredComponents - ) { - #(<#active_field_types as #ecs_path::bundle::Bundle>::register_required_components(components, required_components);)* - } } }; diff --git a/crates/bevy_ecs/src/bundle.rs b/crates/bevy_ecs/src/bundle.rs index 8efdc60ad9..78948f81b1 100644 --- a/crates/bevy_ecs/src/bundle.rs +++ b/crates/bevy_ecs/src/bundle.rs @@ -207,12 +207,6 @@ pub unsafe trait Bundle: DynamicBundle + Send + Sync + 'static { /// Gets this [`Bundle`]'s component ids. This will be [`None`] if the component has not been registered. fn get_component_ids(components: &Components, ids: &mut impl FnMut(Option)); - - /// Registers components that are required by the components in this [`Bundle`]. - fn register_required_components( - _components: &mut ComponentsRegistrator, - _required_components: &mut RequiredComponents, - ); } /// Creates a [`Bundle`] by taking it from internal storage. @@ -279,20 +273,6 @@ unsafe impl Bundle for C { ids(components.register_component::()); } - fn register_required_components( - components: &mut ComponentsRegistrator, - required_components: &mut RequiredComponents, - ) { - let component_id = components.register_component::(); - ::register_required_components( - component_id, - components, - required_components, - 0, - &mut Vec::new(), - ); - } - fn get_component_ids(components: &Components, ids: &mut impl FnMut(Option)) { ids(components.get_id(TypeId::of::())); } @@ -347,13 +327,6 @@ macro_rules! tuple_impl { fn get_component_ids(components: &Components, ids: &mut impl FnMut(Option)){ $(<$name as Bundle>::get_component_ids(components, ids);)* } - - fn register_required_components( - components: &mut ComponentsRegistrator, - required_components: &mut RequiredComponents, - ) { - $(<$name as Bundle>::register_required_components(components, required_components);)* - } } #[expect( diff --git a/crates/bevy_ecs/src/spawn.rs b/crates/bevy_ecs/src/spawn.rs index 0c30c14b9c..8e1a019222 100644 --- a/crates/bevy_ecs/src/spawn.rs +++ b/crates/bevy_ecs/src/spawn.rs @@ -199,16 +199,6 @@ unsafe impl + Send + Sync + 'static> Bundle ) { ::get_component_ids(components, ids); } - - fn register_required_components( - components: &mut crate::component::ComponentsRegistrator, - required_components: &mut crate::component::RequiredComponents, - ) { - ::register_required_components( - components, - required_components, - ); - } } impl> DynamicBundle for SpawnRelatedBundle { @@ -267,16 +257,6 @@ unsafe impl Bundle for SpawnOneRelated { ) { ::get_component_ids(components, ids); } - - fn register_required_components( - components: &mut crate::component::ComponentsRegistrator, - required_components: &mut crate::component::RequiredComponents, - ) { - ::register_required_components( - components, - required_components, - ); - } } /// [`RelationshipTarget`] methods that create a [`Bundle`] with a [`DynamicBundle::Effect`] that: diff --git a/release-content/migration-guides/remove_bundle_register_required_components.md b/release-content/migration-guides/remove_bundle_register_required_components.md new file mode 100644 index 0000000000..87b65d7a91 --- /dev/null +++ b/release-content/migration-guides/remove_bundle_register_required_components.md @@ -0,0 +1,6 @@ +--- +title: Remove Bundle::register_required_components +pull_requests: [19967] +--- + +This method was effectively dead-code as it was never used by the ECS to compute required components, hence it was removed. if you were overriding its implementation you can just remove it, as it never did anything. If you were using it in any other way, please open an issue.