-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong
Description
Bevy version and features
Main: 71114e1
What you did
Spawning related entities using SpawnRelated is inconsistent with Insert/Add observers.
fn print_name(
insert: On<Insert, ChildOf>,
names: Query<&Name>,
) -> Result<(), BevyError> {
let name = names.get(insert.entity)?;
dbg!(name);
}
fn spawn_widgets(
mut commands: Commands
) {
commands.spawn((
UiRoot,
// This will panic
children!(
(Button, Name::new("Special Button")),
),
// This will not panic
Children::spawn_one((Button, Name::new("Different Button"))),
// And neither will this
Children::spawn(SpawnRelated(|parent: &mut RelatedSpawner| {
parent.spawn((Slider, Name::new("Interesting Slider"));
})
));
}What went wrong
When using children!() it will panic with The query does not match entity (...).
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong