diff --git a/crates/bevy_hierarchy/src/valid_parent_check_plugin.rs b/crates/bevy_hierarchy/src/valid_parent_check_plugin.rs index d07f38d3bb232a..638282ab4bffd2 100644 --- a/crates/bevy_hierarchy/src/valid_parent_check_plugin.rs +++ b/crates/bevy_hierarchy/src/valid_parent_check_plugin.rs @@ -70,7 +70,7 @@ where /// which parent hasn't a `T` component. /// /// See [`check_hierarchy_component_has_valid_parent`] for details. -pub struct ValidParentCheckPlugin(PhantomData T>); +pub struct ValidParentCheckPlugin(PhantomData T>); impl Default for ValidParentCheckPlugin { fn default() -> Self { Self(PhantomData) diff --git a/errors/B0004.md b/errors/B0004.md index ceb8fc844880c9..a6b629859d9da6 100644 --- a/errors/B0004.md +++ b/errors/B0004.md @@ -5,12 +5,19 @@ A runtime warning. An [`Entity`] with a hierarchy-inherited component has a [`Parent`] without the hierarchy-inherited component in question. -The hierarchy-inherited components are: +The hierarchy-inherited components defined in bevy include: - [`ComputedVisibility`] - [`GlobalTransform`] -For example, the following code will cause a warning to be emitted: +Third party plugins may also define their own hierarchy components, so +read carefully the warning message and pay attention to the exact type +of the missing component. + +To fix this warning, add the missing hierarchy component to all ancestors +of entities with the hierarchy component you wish to use. + +The following code will cause a warning to be emitted: ```rust,no_run use bevy::prelude::*; @@ -55,7 +62,7 @@ Since the cube is spawned as a child of an entity without the [`ComputedVisibility`] component, it will not be visible at all. To fix this, you must use [`SpatialBundle`] over [`TransformBundle`], -as follow: +as follows: ```rust,no_run use bevy::prelude::*; @@ -100,7 +107,7 @@ However, when a parent [`GlobalTransform`] is missing, it will simply prevent all transform propagation, including when updating the [`Transform`] component of the child. -You will most likely encouter this warning when loading a scene +You will most likely encounter this warning when loading a scene as a child of a pre-existing [`Entity`] that does not have the proper components. [`ComputedVisibility`]: https://docs.rs/bevy/*/bevy/render/view/struct.ComputedVisibility.html